Skip to content

Commit

Permalink
Fix NPE when opening Google Search Assist when a RN Dialog is displayed
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mdvacca authored and facebook-github-bot committed Dec 7, 2018
1 parent 896bb8a commit 69c8aa6
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -15,6 +16,7 @@
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;
Expand Down Expand Up @@ -73,6 +75,12 @@ public ReactModalHostView(Context context) {
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
Expand Down

0 comments on commit 69c8aa6

Please sign in to comment.