Check self.isValid in RCTBatchedBridge after initial script evaluation

Summary: I noticed that sometimes the batched bridge would be valid before `[self enqueueApplicationScript:url:onComplete:]` but then become invalid in the completion callback. This diff checks `self.isValid` inside of the callback.

Closes https://github.com/facebook/react-native/pull/2016

Reviewed By: @​trunkagent, @jspahrsummers

Differential Revision: D2443438

Pulled By: @tadeuzagallo
This commit is contained in:
James Ide 2015-09-24 02:42:39 -07:00 committed by facebook-github-bot-9
parent 974ec059e8
commit 7615d74d14
1 changed files with 4 additions and 0 deletions

View File

@ -340,6 +340,10 @@ RCT_EXTERN NSArray *RCTGetModuleClasses(void);
sourceCodeModule.scriptText = sourceCode;
[self enqueueApplicationScript:sourceCode url:self.bundleURL onComplete:^(NSError *loadError) {
if (!self.isValid) {
return;
}
if (loadError) {
dispatch_async(dispatch_get_main_queue(), ^{
[self stopLoadingWithError:loadError];