Show yellowbox when we fail to load a local image

Reviewed By: achen1

Differential Revision: D4342295

fbshipit-source-id: 9411ffe9a376e1ed51fcadee718326d1d9443fff
This commit is contained in:
Mehdi Mulani 2016-12-19 13:54:49 -08:00 committed by Facebook Github Bot
parent d3d5d7b7c9
commit ac11eedfb0
2 changed files with 4 additions and 1 deletions

View File

@ -105,6 +105,7 @@ static NSBundle *bundleForPath(NSString *key)
completionHandler(nil, image);
} else {
NSString *message = [NSString stringWithFormat:@"Could not find image named %@", imageName];
RCTLogWarn(@"%@", message);
completionHandler(RCTErrorWithMessage(message), nil);
}
});

View File

@ -33,10 +33,12 @@ class RCTLog {
logFn,
'Level "' + level + '" not one of ' + Object.keys(levelsMap)
);
if (typeof global.nativeLoggingHook === 'undefined') {
if (typeof global.nativeLoggingHook === 'undefined' || level === 'warn') {
// We already printed in xcode, so only log here if using a js debugger
// or if we're trying to send a yellow box from native down.
console[logFn].apply(console, args);
}
return true;
}
}