mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Check if mCurrentActivity is set according to LifecycleState (#23336)
Summary: Issues: Related to #13439 react-native-website:Related to PR [#792](https://github.com/facebook/react-native-website/pull/792) solution: https://github.com/facebook/react-native/issues/13439#issuecomment-400256114 When we integration with Existing Android Apps.and set LifecycleState is `LifecycleState.RESUMED`. It's lead to `mCurrentActivity` is null . At this time , the behave of set `mCurrentActivity ` which is unexpectedly. ## Changelog [Android] [Fixed] - Check if mCurrentActivity is set according to LifecycleState Pull Request resolved: https://github.com/facebook/react-native/pull/23336 Differential Revision: D14298654 Pulled By: cpojer fbshipit-source-id: 5cc17539a51154faeb838349b068d92511946f79
This commit is contained in:
committed by
Facebook Github Bot
parent
38adb8ecd2
commit
fb550e9e84
@@ -213,6 +213,14 @@ public class ReactAppTestActivity extends FragmentActivity
|
||||
} else {
|
||||
builder.addPackage(new MainReactPackage());
|
||||
}
|
||||
/**
|
||||
* The {@link ReactContext#mCurrentActivity} never to be set if initial lifecycle state is resumed.
|
||||
* So we should call {@link ReactInstanceManagerBuilder#setCurrentActivity}.
|
||||
*
|
||||
* Finally,{@link ReactInstanceManagerBuilder#build()} will create instance of {@link ReactInstanceManager}.
|
||||
* And also will set {@link ReactContext#mCurrentActivity}.
|
||||
*/
|
||||
builder.setCurrentActivity(this);
|
||||
builder
|
||||
.addPackage(new InstanceSpecForTestPackage(spec))
|
||||
// By not setting a JS module name, we force the bundle to be always loaded from
|
||||
|
||||
Reference in New Issue
Block a user