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

App crashes if changing the data of FlatList with renderItem TextInput quickly #15801

Closed
JenningsWu opened this issue Sep 5, 2017 · 3 comments
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@JenningsWu
Copy link

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

  1. react-native -v: 0.48.1
  2. node -v: 8.4.0
  3. npm -v: 5.3.0
  4. yarn --version:

Then, specify:

  • Target Platform: iOS
  • Development Operating System: macOS
  • Build tools: Xcode 9.0 beta (9M136h)

Steps to Reproduce

(Write your steps here:)

  1. Create a FlatList with renderItem = TextInput, and a Button to control the content of the FlatList
  2. Click the Button quickly ("quckly" means you need to click the button before previous render is finished)
  3. The app will crash.

Expected Behavior

The app shouldn't crash.
If the render item of FlatList is another component like Text, it won't crash.

Actual Behavior

The app crash with log

FlatListOfTextInput[16471:6155941] *** Assertion failure in -[RCTUIManager setIntrinsicContentSize:forView:]_block_invoke(), /Users/jinningwu/Github/FlatListOfTextInput/node_modules/react-native/React/Modules/RCTUIManager.m:389
2017-09-04 19:40:06.314030-0700 FlatListOfTextInput[16471:6155941] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not locate view with tag #4245'
*** First throw call stack:
(0x18a752fe0 0x1891b4538 0x18a752eb4 0x18b1eb7cc 0x100117da4 0x10068da50 0x10068da10 0x10069b2e8 0x100691634 0x10069d630 0x10069d39c 0x189813100 0x189812cac)
libc++abi.dylib: terminating with uncaught exception of type NSException

Reproducible Demo

Could use this repo JenningsWu/FlatListOfTextInput to reproduce it.

It is interesting that I failed to reproduce the crash with expo Snack.

To reproduce, just run this repo with react-native run-ios or build with Xcode.

@JenningsWu
Copy link
Author

It seems that it will only crash with configuration Debug.

@simonracz
Copy link
Contributor

We also ran into this issue last week. Pretty annoying bug. I am glad we are not the only ones. :)

facebook-github-bot pushed a commit that referenced this issue Oct 3, 2017
Summary:
This fixes [#15801](#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 #16170

Differential Revision: D5959776

Pulled By: shergin

fbshipit-source-id: f39f5a3f1d86b330ecf7cbccd90871bc01fd69d9
StevenLambion pushed a commit to StevenLambion/react-native that referenced this issue 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 issue 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
@stale
Copy link

stale bot commented Dec 1, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Dec 1, 2017
@stale stale bot closed this as completed Dec 8, 2017
@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants