mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-02 14:54:58 +08:00
Fix BadTokenException when displaying warning messages
Reviewed By: achen1 Differential Revision: D6651871 fbshipit-source-id: fc7fc118999f0e752636a3142764bd3496e5dc81
This commit is contained in:
committed by
Facebook Github Bot
parent
46be5bf71c
commit
0356cbd13b
@@ -9,6 +9,7 @@
|
||||
|
||||
package com.facebook.react.devsupport;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -371,8 +372,8 @@ public class DevSupportManagerImpl implements
|
||||
@Override
|
||||
public void run() {
|
||||
if (mRedBoxDialog == null) {
|
||||
Context context = mReactInstanceManagerHelper.getCurrentActivity();
|
||||
if (context == null) {
|
||||
Activity context = mReactInstanceManagerHelper.getCurrentActivity();
|
||||
if (context == null || context.isFinishing()) {
|
||||
FLog.e(ReactConstants.TAG, "Unable to launch redbox because react activity " +
|
||||
"is not available, here is the error that redbox would've displayed: " + message);
|
||||
return;
|
||||
@@ -518,8 +519,8 @@ public class DevSupportManagerImpl implements
|
||||
|
||||
final DevOptionHandler[] optionHandlers = options.values().toArray(new DevOptionHandler[0]);
|
||||
|
||||
Context context = mReactInstanceManagerHelper.getCurrentActivity();
|
||||
if (context == null) {
|
||||
Activity context = mReactInstanceManagerHelper.getCurrentActivity();
|
||||
if (context == null || context.isFinishing()) {
|
||||
FLog.e(ReactConstants.TAG, "Unable to launch dev options menu because react activity " +
|
||||
"isn't available");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user