Skip to content

Commit 6404166

Browse files
sherginfacebook-github-bot
authored andcommitted
The warning 'cannot calculate shadow efficiently' is not a warning anymore
Reviewed By: fkgozali, yungsters Differential Revision: D4445304 fbshipit-source-id: 3a37150ae2beaf44b505dc36b575b7d44619e071
1 parent e97ffc4 commit 6404166

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Libraries/ReactNative/YellowBox.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const _warningMap: Map<string, WarningInfo> = new Map();
5757

5858
if (__DEV__) {
5959
const {error, warn} = console;
60+
6061
(console: any).error = function() {
6162
error.apply(console, arguments);
6263
// Show yellow box for the `warning` module.
@@ -65,8 +66,15 @@ if (__DEV__) {
6566
updateWarningMap.apply(null, arguments);
6667
}
6768
};
69+
6870
(console: any).warn = function() {
6971
warn.apply(console, arguments);
72+
73+
if (typeof arguments[0] === 'string' &&
74+
arguments[0].startsWith('(ADVICE)')) {
75+
return;
76+
}
77+
7078
updateWarningMap.apply(null, arguments);
7179
};
7280

React/Base/RCTLog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#define RCTLog(...) _RCTLog(RCTLogLevelInfo, __VA_ARGS__)
3232
#define RCTLogTrace(...) _RCTLog(RCTLogLevelTrace, __VA_ARGS__)
3333
#define RCTLogInfo(...) _RCTLog(RCTLogLevelInfo, __VA_ARGS__)
34+
#define RCTLogAdvice(string, ...) RCTLogWarn([@"(ADVICE) " stringByAppendingString:(NSString *)string], __VA_ARGS__)
3435
#define RCTLogWarn(...) _RCTLog(RCTLogLevelWarning, __VA_ARGS__)
3536
#define RCTLogError(...) _RCTLog(RCTLogLevelError, __VA_ARGS__)
3637

React/Views/RCTView.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,10 +575,10 @@ static void RCTUpdateShadowPathForView(RCTView *view)
575575
// Can't accurately calculate box shadow, so fall back to pixel-based shadow
576576
view.layer.shadowPath = nil;
577577

578-
RCTLogWarn(@"View #%@ of type %@ has a shadow set but cannot calculate "
579-
"shadow efficiently. Consider setting a background color to "
580-
"fix this, or apply the shadow to a more specific component.",
581-
view.reactTag, [view class]);
578+
RCTLogAdvice(@"View #%@ of type %@ has a shadow set but cannot calculate "
579+
"shadow efficiently. Consider setting a background color to "
580+
"fix this, or apply the shadow to a more specific component.",
581+
view.reactTag, [view class]);
582582
}
583583
}
584584
}

0 commit comments

Comments
 (0)