Skip to content

Commit 69c8aa6

Browse files
mdvaccafacebook-github-bot
authored andcommitted
Fix NPE when opening Google Search Assist when a RN Dialog is displayed
Summary: This fixes app crashes on opening android search assistant when a RN modal is visible. The root cause is that ViewGroup.dispatchProvideStructure() method uses the private variable 'mChildren' to access the children of a view group instead of the publicApi. This fixes the top crash for the react_MarketplaceProductDetailsNonIPadRoute route. This also fixes github issues: #15932 #13201 #15440 that were closed without a fix Reviewed By: PeteTheHeat Differential Revision: D13375993 fbshipit-source-id: d603cb4ef65a423c63a6ef2b51235702c7dbffcb
1 parent 896bb8a commit 69c8aa6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java

+8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
package com.facebook.react.views.modal;
99

10+
import android.annotation.TargetApi;
1011
import android.app.Activity;
1112
import android.app.Dialog;
1213
import android.content.Context;
@@ -15,6 +16,7 @@
1516
import android.view.MotionEvent;
1617
import android.view.View;
1718
import android.view.ViewGroup;
19+
import android.view.ViewStructure;
1820
import android.view.WindowManager;
1921
import android.view.accessibility.AccessibilityEvent;
2022
import android.widget.FrameLayout;
@@ -73,6 +75,12 @@ public ReactModalHostView(Context context) {
7375
mHostView = new DialogRootViewGroup(context);
7476
}
7577

78+
@TargetApi(23)
79+
@Override
80+
public void dispatchProvideStructure(ViewStructure structure) {
81+
mHostView.dispatchProvideStructure(structure);
82+
}
83+
7684
@Override
7785
protected void onLayout(boolean changed, int l, int t, int r, int b) {
7886
// Do nothing as we are laid out by UIManager

0 commit comments

Comments
 (0)