Show redbox when no bundle is present

Reviewed By: shergin

Differential Revision: D4405409

fbshipit-source-id: 847fc559121dcde844f1ee3c6d02206e9e27803b
This commit is contained in:
Pieter De Baets 2017-01-13 03:37:15 -08:00 committed by Facebook Github Bot
parent 09a83f976e
commit a94418fdd3
2 changed files with 6 additions and 4 deletions

View File

@ -192,9 +192,11 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)dele
[self.delegate loadSourceForBridge:_parentBridge onProgress:onProgress onComplete:onSourceLoad]; [self.delegate loadSourceForBridge:_parentBridge onProgress:onProgress onComplete:onSourceLoad];
} else if ([self.delegate respondsToSelector:@selector(loadSourceForBridge:withBlock:)]) { } else if ([self.delegate respondsToSelector:@selector(loadSourceForBridge:withBlock:)]) {
[self.delegate loadSourceForBridge:_parentBridge withBlock:onSourceLoad]; [self.delegate loadSourceForBridge:_parentBridge withBlock:onSourceLoad];
} else if (!self.bundleURL) {
NSError *error = RCTErrorWithMessage(@"No bundle URL present.\n\nMake sure you're running a packager " \
"server or have included a .jsbundle file in your application bundle.");
onSourceLoad(error, nil, 0);
} else { } else {
RCTAssert(self.bundleURL, @"bundleURL must be non-nil when not implementing loadSourceForBridge");
[RCTJavaScriptLoader loadBundleAtURL:self.bundleURL onProgress:onProgress onComplete:^(NSError *error, NSData *source, int64_t sourceLength) { [RCTJavaScriptLoader loadBundleAtURL:self.bundleURL onProgress:onProgress onComplete:^(NSError *error, NSData *source, int64_t sourceLength) {
if (error && [self.delegate respondsToSelector:@selector(fallbackSourceURLForBridge:)]) { if (error && [self.delegate respondsToSelector:@selector(fallbackSourceURLForBridge:)]) {
NSURL *fallbackURL = [self.delegate fallbackSourceURLForBridge:self->_parentBridge]; NSURL *fallbackURL = [self.delegate fallbackSourceURLForBridge:self->_parentBridge];

View File

@ -13,8 +13,8 @@
#include <cxxabi.h> #include <cxxabi.h>
#import "RCTAssert.h" #import "RCTAssert.h"
#import "RCTBridge.h"
#import "RCTBridge+Private.h" #import "RCTBridge+Private.h"
#import "RCTBridge.h"
#import "RCTDefines.h" #import "RCTDefines.h"
#import "RCTRedBox.h" #import "RCTRedBox.h"
#import "RCTUtils.h" #import "RCTUtils.h"
@ -229,7 +229,7 @@ void _RCTLogNativeInternal(RCTLogLevel level, const char *fileName, int lineNumb
} }
NSRange range = NSMakeRange(0, frameSymbols.length); NSRange range = NSMakeRange(0, frameSymbols.length);
NSTextCheckingResult *match = [nativeStackFrameRegex() firstMatchInString:frameSymbols options:0 range:range]; NSTextCheckingResult *match = [nativeStackFrameRegex() firstMatchInString:frameSymbols options:0 range:range];
if (!match) { if (!match) {
return; return;
} }