diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java index 1e06f6abb7b..c04401f822a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java @@ -316,7 +316,7 @@ public class ReactHostImpl implements ReactHost { setCurrentActivity(activity); ReactContext currentContext = getCurrentReactContext(); - // TODO(T137233065): Enable DevSupportManager here + maybeEnableDevSupport(true); mReactLifecycleStateManager.moveToOnHostResume(currentContext, getCurrentActivity()); } @@ -354,7 +354,7 @@ public class ReactHostImpl implements ReactHost { + activityClass); } - // TODO(T137233065): Disable DevSupportManager here + maybeEnableDevSupport(false); mDefaultHardwareBackBtnHandler = null; mReactLifecycleStateManager.moveToOnHostPause(currentContext, currentActivity); } @@ -368,7 +368,7 @@ public class ReactHostImpl implements ReactHost { ReactContext currentContext = getCurrentReactContext(); - // TODO(T137233065): Disable DevSupportManager here + maybeEnableDevSupport(false); mDefaultHardwareBackBtnHandler = null; mReactLifecycleStateManager.moveToOnHostPause(currentContext, getCurrentActivity()); } @@ -380,7 +380,7 @@ public class ReactHostImpl implements ReactHost { final String method = "onHostDestroy()"; log(method); - // TODO(T137233065): Disable DevSupportManager here + maybeEnableDevSupport(false); moveToHostDestroy(getCurrentReactContext()); } @@ -392,12 +392,18 @@ public class ReactHostImpl implements ReactHost { Activity currentActivity = getCurrentActivity(); - // TODO(T137233065): Disable DevSupportManager here + maybeEnableDevSupport(false); if (currentActivity == activity) { moveToHostDestroy(getCurrentReactContext()); } } + private void maybeEnableDevSupport(boolean enabled) { + if (mUseDevSupport) { + mDevSupportManager.setDevSupportEnabled(enabled); + } + } + /** * Returns current ReactContext which could be nullable if ReactInstance hasn't been created. *