-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Resolve android crash on display modal #35380
Conversation
Base commit: 04c286c |
Base commit: 3681df2 |
PR build artifact for 24da660 is ready. |
PR build artifact for 24da660 is ready. |
@ryancat has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: From exception logging, found crashes due to `Attempt to invoke virtual method 'int android.view.ViewGroup.getChildCount()' on a null object reference`. Tracing through the stack, it appears the constructor for `ViewGroup` conditionally calls `initializeScrollbarsInternal()`, which in turn calls `getChildCount()`. However `ReactModalHostView` overrides `getChildCount()`, so `getChildCount()` is called before `ReactModalHostView` constructor completes, resulting in null reference when accessing `mHostView` from `getChildCount()`. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [Android] [Fixed] - Fix crash on initialize modal Pull Request resolved: #35380 Test Plan: In the rn-tester project, display a modal. Reviewed By: javache, cipolleschi Differential Revision: D41392235 Pulled By: ryancat fbshipit-source-id: ce78e4d458ad41769e78139ea0a8a038384e830d
Summary: From exception logging, found crashes due to `Attempt to invoke virtual method 'int android.view.ViewGroup.getChildCount()' on a null object reference`. Tracing through the stack, it appears the constructor for `ViewGroup` conditionally calls `initializeScrollbarsInternal()`, which in turn calls `getChildCount()`. However `ReactModalHostView` overrides `getChildCount()`, so `getChildCount()` is called before `ReactModalHostView` constructor completes, resulting in null reference when accessing `mHostView` from `getChildCount()`. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [Android] [Fixed] - Fix crash on initialize modal Pull Request resolved: facebook#35380 Test Plan: In the rn-tester project, display a modal. Reviewed By: javache, cipolleschi Differential Revision: D41392235 Pulled By: ryancat fbshipit-source-id: ce78e4d458ad41769e78139ea0a8a038384e830d
Summary
From exception logging, found crashes due to
Attempt to invoke virtual method 'int android.view.ViewGroup.getChildCount()' on a null object reference
. Tracing through the stack, it appears the constructor forViewGroup
conditionally callsinitializeScrollbarsInternal()
, which in turn callsgetChildCount()
. HoweverReactModalHostView
overridesgetChildCount()
, sogetChildCount()
is called beforeReactModalHostView
constructor completes, resulting in null reference when accessingmHostView
fromgetChildCount()
.Changelog
[Android] [Fixed] - Fix crash on initialize modal
Test Plan
In the rn-tester project, display a modal.