Fix crash when double launching activity
Reviewed By: AaaChiuuu Differential Revision: D2633573 fb-gh-sync-id: c47bec903d54c12f4d9e576ad1aaf16d4bd68f30
This commit is contained in:
parent
666706b0da
commit
de4cb7d403
|
@ -227,10 +227,14 @@ public class ReactContext extends ContextWrapper {
|
|||
|
||||
/**
|
||||
* Same as {@link Activity#startActivityForResult(Intent, int)}, this just redirects the call to
|
||||
* the current activity.
|
||||
* 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 void startActivityForResult(Intent intent, int code, Bundle bundle) {
|
||||
Assertions.assertNotNull(mCurrentActivity);
|
||||
public boolean startActivityForResult(Intent intent, int code, Bundle bundle) {
|
||||
if (mCurrentActivity == null) {
|
||||
return false;
|
||||
}
|
||||
mCurrentActivity.startActivityForResult(intent, code, bundle);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue