Skip to content

Commit ac11eed

Browse files
Mehdi Mulanifacebook-github-bot
authored andcommitted
Show yellowbox when we fail to load a local image
Reviewed By: achen1 Differential Revision: D4342295 fbshipit-source-id: 9411ffe9a376e1ed51fcadee718326d1d9443fff
1 parent d3d5d7b commit ac11eed

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Libraries/Image/RCTLocalAssetImageLoader.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ - (RCTImageLoaderCancellationBlock)loadImageForURL:(NSURL *)imageURL
105105
completionHandler(nil, image);
106106
} else {
107107
NSString *message = [NSString stringWithFormat:@"Could not find image named %@", imageName];
108+
RCTLogWarn(@"%@", message);
108109
completionHandler(RCTErrorWithMessage(message), nil);
109110
}
110111
});

Libraries/Utilities/RCTLog.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ class RCTLog {
3333
logFn,
3434
'Level "' + level + '" not one of ' + Object.keys(levelsMap)
3535
);
36-
if (typeof global.nativeLoggingHook === 'undefined') {
36+
if (typeof global.nativeLoggingHook === 'undefined' || level === 'warn') {
3737
// We already printed in xcode, so only log here if using a js debugger
38+
// or if we're trying to send a yellow box from native down.
3839
console[logFn].apply(console, args);
3940
}
41+
4042
return true;
4143
}
4244
}

0 commit comments

Comments
 (0)