Fix RCTRootView invalidation using the wrong bridge

Reviewed By: majak

Differential Revision: D3696533

fbshipit-source-id: e7ef4373e975e585f4c34df71966c8b5b30d3e9a
This commit is contained in:
Pieter De Baets 2016-08-10 07:41:54 -07:00 committed by Facebook Github Bot 1
parent 0cc3b4b079
commit 4afaf5e538
2 changed files with 7 additions and 3 deletions

View File

@ -218,8 +218,8 @@ class MessageQueue {
const moduleMethods = this._callableModules[module]; const moduleMethods = this._callableModules[module];
invariant( invariant(
!!moduleMethods, !!moduleMethods,
'Module %s is not a registered callable module.', 'Module %s is not a registered callable module (calling %s)',
module module, method
); );
invariant( invariant(
!!moduleMethods[method], !!moduleMethods[method],

View File

@ -15,6 +15,7 @@
#import "RCTAssert.h" #import "RCTAssert.h"
#import "RCTBridge.h" #import "RCTBridge.h"
#import "RCTBridge+Private.h"
#import "RCTEventDispatcher.h" #import "RCTEventDispatcher.h"
#import "RCTKeyCommands.h" #import "RCTKeyCommands.h"
#import "RCTLog.h" #import "RCTLog.h"
@ -92,7 +93,7 @@ NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotificat
object:self]; object:self];
if (!_bridge.loading) { if (!_bridge.loading) {
[self bundleFinishedLoading:_bridge]; [self bundleFinishedLoading:[_bridge batchedBridge]];
} }
[self showLoadingView]; [self showLoadingView];
@ -199,6 +200,9 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
- (void)javaScriptDidLoad:(NSNotification *)notification - (void)javaScriptDidLoad:(NSNotification *)notification
{ {
RCTAssertMainQueue(); 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"]; RCTBridge *bridge = notification.userInfo[@"bridge"];
[self bundleFinishedLoading:bridge]; [self bundleFinishedLoading:bridge];
} }