Repository navigation
Return no next view when a ScrollView's content view is gone - #59075
Draft
YevheniiKotyrlo wants to merge 1 commit into
Draft
YevheniiKotyrlo wants to merge 1 commit into
YevheniiKotyrlo wants to merge 1 commit into
Conversation
findNextFocusableView read host.getChildAt(0).id without checking for the child, so a focus search on a scroll view whose content view had already been removed threw a NullPointerException, as react#53046 reports for a screen navigating back with a focused TextInput. It now returns null, which leaves the platform's own answer in place.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
ReactScrollViewHelper.findNextFocusableViewreadshost.getChildAt(0).idwithout checking for the child, so a focus search that reaches a scroll view whose content view has already been removed throws fromReactScrollView.focusSearch:#53046 reports it while a screen with a focused
TextInputin aScrollViewnavigates back; it was closed as stale, andmainstill dereferences the child. The search now returnsnullwhen there is no content view, sofocusSearchkeeps the platform's answer.Changelog:
[ANDROID] [FIXED] - Crash in a
ScrollView's keyboard focus search after its content view has been removedTest Plan:
ReactScrollViewHelperFocusSearchTest: a vertical and a horizontal scroll view with no content view, the Fabric lookup returning a next focusable. Onmainboth fail with theNullPointerExceptionabove, thrown at thegetChildAt(0).idread; with this change both returnnull../gradlew :packages:react-native:ReactAndroid:testDebugUnitTest --tests "com.facebook.react.views.scroll.*" -PenableWarningsAsErrors=truepasses, and ktfmt is clean on both files.