Skip to content

Conversation

@shigggster
Copy link

If you have multiple KASVs and multiple text input fields across multiple containers, and wish to use the KASV update() solution to resolve your multi-line scrollView issue - you may come across this particular error screen.

screen shot 2018-11-20 at 5 02 54 pm

We reference and summarize @alvaromb’s thorough explanation below, regarding checking React node descendants - specifically his discussion around checking if a focused TextInput is a descendent of a specific ScrollView.

For example, say there is a base screen that has ScrollView and multiple input fields. The user then taps on a button and navigates to another screen which also has ScrollView and input fields. Since the base screen did not unmount, both ScrollViews continue to exist and both will receive the keyboard events. This will cause your app to crash when the user taps on an input field on that second screen.

By checking first in the update() function that the focused TextInput field is a descendant of a specific ScrollView, we can avoid the ScrollView (that does not have the focused input as a descendent) attempting to scroll to the focused input and then crashing.

screen shot 2018-11-21 at 12 38 50 pm

@shigggster
Copy link
Author

Closing this pull request for now. The descendant check is too slow to be called on componentDidUpdate.

@shigggster shigggster closed this Dec 5, 2018
@ymanjuy
Copy link

ymanjuy commented Jan 2, 2020

@shigggster what is the solution to avoid this message?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants