From d7ddff75544de86e5c8b79ea111aab5b386a6874 Mon Sep 17 00:00:00 2001 From: Alex Kotliarskyi Date: Tue, 30 Jun 2015 17:08:28 -0700 Subject: [PATCH] [ReactNative] Fix dev menu customization when JS fails to load --- React/Base/RCTBatchedBridge.m | 3 +++ React/Base/RCTBridge.h | 5 +++++ React/Base/RCTBridge.m | 1 + 3 files changed, 9 insertions(+) diff --git a/React/Base/RCTBatchedBridge.m b/React/Base/RCTBatchedBridge.m index 0d89d651d..b1bb6cf1a 100644 --- a/React/Base/RCTBatchedBridge.m +++ b/React/Base/RCTBatchedBridge.m @@ -219,6 +219,9 @@ RCT_NOT_IMPLEMENTED(-initWithBundleURL:(__unused NSURL *)bundleURL [_frameUpdateObservers addObject:moduleData]; } } + + [[NSNotificationCenter defaultCenter] postNotificationName:RCTDidCreateNativeModules + object:self]; } - (void)initJS diff --git a/React/Base/RCTBridge.h b/React/Base/RCTBridge.h index 1d70a6367..f12f26158 100644 --- a/React/Base/RCTBridge.h +++ b/React/Base/RCTBridge.h @@ -33,6 +33,11 @@ RCT_EXTERN NSString *const RCTJavaScriptDidLoadNotification; */ RCT_EXTERN NSString *const RCTJavaScriptDidFailToLoadNotification; +/** + * This notification fires when the bridge created all registered native modules + */ +RCT_EXTERN NSString *const RCTDidCreateNativeModules; + /** * This block can be used to instantiate modules that require additional * init parameters, or additional configuration prior to being used. diff --git a/React/Base/RCTBridge.m b/React/Base/RCTBridge.m index 28fcc460f..c6baf82a6 100644 --- a/React/Base/RCTBridge.m +++ b/React/Base/RCTBridge.m @@ -20,6 +20,7 @@ NSString *const RCTReloadNotification = @"RCTReloadNotification"; NSString *const RCTJavaScriptDidLoadNotification = @"RCTJavaScriptDidLoadNotification"; NSString *const RCTJavaScriptDidFailToLoadNotification = @"RCTJavaScriptDidFailToLoadNotification"; +NSString *const RCTDidCreateNativeModules = @"RCTDidCreateNativeModules"; @class RCTBatchedBridge;