mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 11:57:46 +08:00
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: https://github.com/facebook/react-native/issues/15932 https://github.com/facebook/react-native/issues/13201 https://github.com/facebook/react-native/issues/15440 that were closed without a fix Reviewed By: PeteTheHeat Differential Revision: D13375993 fbshipit-source-id: d603cb4ef65a423c63a6ef2b51235702c7dbffcb
This commit is contained in:
committed by
Facebook Github Bot
parent
896bb8a21e
commit
69c8aa64e5
@@ -7,6 +7,7 @@
|
||||
|
||||
package com.facebook.react.views.modal;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
@@ -15,6 +16,7 @@ import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewStructure;
|
||||
import android.view.WindowManager;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.widget.FrameLayout;
|
||||
@@ -73,6 +75,12 @@ public class ReactModalHostView extends ViewGroup implements LifecycleEventListe
|
||||
mHostView = new DialogRootViewGroup(context);
|
||||
}
|
||||
|
||||
@TargetApi(23)
|
||||
@Override
|
||||
public void dispatchProvideStructure(ViewStructure structure) {
|
||||
mHostView.dispatchProvideStructure(structure);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
// Do nothing as we are laid out by UIManager
|
||||
|
||||
Reference in New Issue
Block a user