Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed a wrong assert. #16170

Closed
wants to merge 2 commits into from
Closed

Removed a wrong assert. #16170

wants to merge 2 commits into from

Conversation

simonracz
Copy link
Contributor

This fixes #15801

We ran into a strange crash on iOS (debug only). After removing the clutter I was able to reproduce it in a tiny app. You can check it out here.

The UI in JS and native are not always in sync (which is okay). Due to this, a native view might call back into JS, which is no longer present in the shadow view hierarchy there. I think this should be also okay.

TextInput in some cases calls into setIntrinsicContentView, where it triggers an overly enthusiastic NSAssert and crashes the app.

Test Plan

Check out textinput_stress
Rotate the simulator a few times to see the crash or the lack of crash.

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. GH Review: review-needed labels Oct 2, 2017
Copy link
Contributor

@shergin shergin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change it to RCTWarn and clarify the message?

@simonracz
Copy link
Contributor Author

Hey @shergin ,

I've updated the PR.

I checked that I see the log message (and not a crash) in my sample app.

FYI, there are several places in RCTUIManager.m with the same RCTAssert : RCTAssert(shadowView != nil, @"Could not locate view with tag #%@", reactTag);

I haven't touched them now, because I am not sure whether those are also bugs. My gut feeling is that most of those should be also only warnings.

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Oct 2, 2017
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shergin is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@shergin
Copy link
Contributor

shergin commented Oct 2, 2017

I agree, it should be special internal method (something like executeBlockWithShadowView:forView:) which have to check shadowView for null and produce warning.

StevenLambion pushed a commit to StevenLambion/react-native that referenced this pull request Oct 13, 2017
Summary:
This fixes [facebook#15801](facebook#15801)

We ran into a strange crash on iOS (debug only). After removing the clutter I was able to reproduce it in a tiny app. You can check it out [here.](https://github.com/simonracz/textinput_stress)

The UI in JS and native are not always in sync (which is okay). Due to this, a native view might call back into JS, which is no longer present in the shadow view hierarchy there. I think this should be also okay.

TextInput in some cases calls into [setIntrinsicContentView](https://github.com/facebook/react-native/blob/6d67e2dbbcd658b7f845ebb0d0156bd64dc68226/React/Modules/RCTUIManager.m#L382), where it triggers an overly enthusiastic `NSAssert` and crashes the app.

Check out [textinput_stress](https://github.com/simonracz/textinput_stress)
Rotate the simulator a few times to see the crash or the lack of crash.
Closes facebook#16170

Differential Revision: D5959776

Pulled By: shergin

fbshipit-source-id: f39f5a3f1d86b330ecf7cbccd90871bc01fd69d9
StevenLambion pushed a commit to StevenLambion/react-native that referenced this pull request Oct 13, 2017
Summary:
This fixes [facebook#15801](facebook#15801)

We ran into a strange crash on iOS (debug only). After removing the clutter I was able to reproduce it in a tiny app. You can check it out [here.](https://github.com/simonracz/textinput_stress)

The UI in JS and native are not always in sync (which is okay). Due to this, a native view might call back into JS, which is no longer present in the shadow view hierarchy there. I think this should be also okay.

TextInput in some cases calls into [setIntrinsicContentView](https://github.com/facebook/react-native/blob/6d67e2dbbcd658b7f845ebb0d0156bd64dc68226/React/Modules/RCTUIManager.m#L382), where it triggers an overly enthusiastic `NSAssert` and crashes the app.

Check out [textinput_stress](https://github.com/simonracz/textinput_stress)
Rotate the simulator a few times to see the crash or the lack of crash.
Closes facebook#16170

Differential Revision: D5959776

Pulled By: shergin

fbshipit-source-id: f39f5a3f1d86b330ecf7cbccd90871bc01fd69d9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

App crashes if changing the data of FlatList with renderItem TextInput quickly
3 participants