Permalink
Browse files

The warning 'cannot calculate shadow efficiently' is not a warning an…

…ymore

Reviewed By: fkgozali, yungsters

Differential Revision: D4445304

fbshipit-source-id: 3a37150ae2beaf44b505dc36b575b7d44619e071
  • Loading branch information...
shergin authored and facebook-github-bot committed Jan 25, 2017
1 parent e97ffc4 commit 64041669eee59236299e95735488c29a5f5d04e9
Showing with 13 additions and 4 deletions.
  1. +8 −0 Libraries/ReactNative/YellowBox.js
  2. +1 −0 React/Base/RCTLog.h
  3. +4 −4 React/Views/RCTView.m
@@ -57,6 +57,7 @@ const _warningMap: Map<string, WarningInfo> = new Map();
if (__DEV__) {
const {error, warn} = console;
(console: any).error = function() {
error.apply(console, arguments);
// Show yellow box for the `warning` module.
@@ -65,8 +66,15 @@ if (__DEV__) {
updateWarningMap.apply(null, arguments);
}
};
(console: any).warn = function() {
warn.apply(console, arguments);
if (typeof arguments[0] === 'string' &&
arguments[0].startsWith('(ADVICE)')) {
return;
}
updateWarningMap.apply(null, arguments);
};
View
@@ -31,6 +31,7 @@
#define RCTLog(...) _RCTLog(RCTLogLevelInfo, __VA_ARGS__)
#define RCTLogTrace(...) _RCTLog(RCTLogLevelTrace, __VA_ARGS__)
#define RCTLogInfo(...) _RCTLog(RCTLogLevelInfo, __VA_ARGS__)
#define RCTLogAdvice(string, ...) RCTLogWarn([@"(ADVICE) " stringByAppendingString:(NSString *)string], __VA_ARGS__)
#define RCTLogWarn(...) _RCTLog(RCTLogLevelWarning, __VA_ARGS__)
#define RCTLogError(...) _RCTLog(RCTLogLevelError, __VA_ARGS__)
View
@@ -575,10 +575,10 @@ static void RCTUpdateShadowPathForView(RCTView *view)
// Can't accurately calculate box shadow, so fall back to pixel-based shadow
view.layer.shadowPath = nil;
RCTLogWarn(@"View #%@ of type %@ has a shadow set but cannot calculate "
"shadow efficiently. Consider setting a background color to "
"fix this, or apply the shadow to a more specific component.",
view.reactTag, [view class]);
RCTLogAdvice(@"View #%@ of type %@ has a shadow set but cannot calculate "
"shadow efficiently. Consider setting a background color to "
"fix this, or apply the shadow to a more specific component.",
view.reactTag, [view class]);
}
}
}

0 comments on commit 6404166

Please sign in to comment.