diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java index ee669462a..ca2d40c73 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java @@ -225,15 +225,17 @@ public class ReactContext extends ContextWrapper { } } + public boolean hasCurrentActivity() { + return mCurrentActivity != null; + } + /** * Same as {@link Activity#startActivityForResult(Intent, int)}, this just redirects the call to * the current activity. Returns whether the activity was started, as this might fail if this * was called before the context is in the right state. */ public boolean startActivityForResult(Intent intent, int code, Bundle bundle) { - if (mCurrentActivity == null) { - return false; - } + Assertions.assertNotNull(mCurrentActivity); mCurrentActivity.startActivityForResult(intent, code, bundle); return true; }