diff --git a/React/CoreModules/RCTDevSettings.mm b/React/CoreModules/RCTDevSettings.mm index e243eb0e0ade1e..e19a810d877364 100644 --- a/React/CoreModules/RCTDevSettings.mm +++ b/React/CoreModules/RCTDevSettings.mm @@ -117,6 +117,7 @@ - (void)_reloadWithDefaults:(NSDictionary *)defaultValues #if RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION static RCTHandlerToken reloadToken; +static RCTHandlerToken devMenuToken; static std::atomic numInitializedModules{0}; #endif @@ -195,6 +196,14 @@ - (void)initialize } queue:dispatch_get_main_queue() forMethod:@"reload"]; +#if RCT_DEV_MENU + devMenuToken = [[RCTPackagerConnection sharedPackagerConnection] + addNotificationHandler:^(id params) { + [self.bridge.devMenu show]; + } + queue:dispatch_get_main_queue() + forMethod:@"devMenu"]; +#endif } #endif @@ -246,6 +255,9 @@ - (void)invalidate if (--numInitializedModules == 0) { [[RCTPackagerConnection sharedPackagerConnection] removeHandler:reloadToken]; +#if RCT_DEV_MENU + [[RCTPackagerConnection sharedPackagerConnection] removeHandler:devMenuToken]; +#endif } #endif }