Fix BadTokenException when displaying warning messages
Reviewed By: achen1 Differential Revision: D6651871 fbshipit-source-id: fc7fc118999f0e752636a3142764bd3496e5dc81
This commit is contained in:
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;
|
||||
|
|
Loading…
Reference in New Issue