From 4afaf5e538f2952021f7bb99565974803cbbfafa Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Wed, 10 Aug 2016 07:41:54 -0700 Subject: [PATCH] Fix RCTRootView invalidation using the wrong bridge Reviewed By: majak Differential Revision: D3696533 fbshipit-source-id: e7ef4373e975e585f4c34df71966c8b5b30d3e9a --- Libraries/Utilities/MessageQueue.js | 4 ++-- React/Base/RCTRootView.m | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Libraries/Utilities/MessageQueue.js b/Libraries/Utilities/MessageQueue.js index 4f00753aa10..5eec64eb6d8 100644 --- a/Libraries/Utilities/MessageQueue.js +++ b/Libraries/Utilities/MessageQueue.js @@ -218,8 +218,8 @@ class MessageQueue { const moduleMethods = this._callableModules[module]; invariant( !!moduleMethods, - 'Module %s is not a registered callable module.', - module + 'Module %s is not a registered callable module (calling %s)', + module, method ); invariant( !!moduleMethods[method], diff --git a/React/Base/RCTRootView.m b/React/Base/RCTRootView.m index 01c03e10584..d8d0f90f2f1 100644 --- a/React/Base/RCTRootView.m +++ b/React/Base/RCTRootView.m @@ -15,6 +15,7 @@ #import "RCTAssert.h" #import "RCTBridge.h" +#import "RCTBridge+Private.h" #import "RCTEventDispatcher.h" #import "RCTKeyCommands.h" #import "RCTLog.h" @@ -92,7 +93,7 @@ NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotificat object:self]; if (!_bridge.loading) { - [self bundleFinishedLoading:_bridge]; + [self bundleFinishedLoading:[_bridge batchedBridge]]; } [self showLoadingView]; @@ -199,6 +200,9 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) - (void)javaScriptDidLoad:(NSNotification *)notification { RCTAssertMainQueue(); + + // Use the (batched) bridge that's sent in the notification payload, so the + // RCTRootContentView is scoped to the right bridge RCTBridge *bridge = notification.userInfo[@"bridge"]; [self bundleFinishedLoading:bridge]; }