mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
moveToResumedLifecycleState must be called from UI thread
Summary: I was seeing a SoftException in our apps due to this method being called as part of ReactInstanceManager's init. It seems inconsistent that we would call this from a background thread when all other `onHost*` methods are marked as confined to the UI thread. Changelog: [Internal] Reviewed By: ryancat Differential Revision: D34340210 fbshipit-source-id: 0104eda66b2ca6bb315e64e806e9a30409d0d45c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
bb7214b9c4
commit
fc35a65a7e
@@ -254,6 +254,7 @@ public class ReactContext extends ContextWrapper {
|
||||
}
|
||||
|
||||
/** Should be called by the hosting Fragment in {@link Fragment#onResume} */
|
||||
@ThreadConfined(UI)
|
||||
public void onHostResume(@Nullable Activity activity) {
|
||||
mLifecycleState = LifecycleState.RESUMED;
|
||||
mCurrentActivity = new WeakReference(activity);
|
||||
@@ -282,6 +283,7 @@ public class ReactContext extends ContextWrapper {
|
||||
}
|
||||
|
||||
/** Should be called by the hosting Fragment in {@link Fragment#onPause} */
|
||||
@ThreadConfined(UI)
|
||||
public void onHostPause() {
|
||||
mLifecycleState = LifecycleState.BEFORE_RESUME;
|
||||
ReactMarker.logMarker(ReactMarkerConstants.ON_HOST_PAUSE_START);
|
||||
|
||||
Reference in New Issue
Block a user