mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 22:50:10 +08:00
workaround T43930203 where originalConsole.assert doesn't properly check the condition and always fires
Summary: Workaround for bugs with originalConsole.assert firing when it shouldn't. Reviewed By: Hypuk Differential Revision: D15201459 fbshipit-source-id: d4cf648725cf42754561468b23ea8edd7c1b84b2
This commit is contained in:
committed by
Facebook Github Bot
parent
920632cadb
commit
a87af19d3f
@@ -557,7 +557,15 @@ if (global.nativeLoggingHook) {
|
||||
const reactNativeMethod = console[methodName];
|
||||
if (originalConsole[methodName]) {
|
||||
console[methodName] = function() {
|
||||
originalConsole[methodName](...arguments);
|
||||
// TODO(T43930203): remove this special case once originalConsole.assert properly checks
|
||||
// the condition
|
||||
if (methodName === 'assert') {
|
||||
if (!arguments[0]) {
|
||||
originalConsole.assert(...arguments);
|
||||
}
|
||||
} else {
|
||||
originalConsole[methodName](...arguments);
|
||||
}
|
||||
reactNativeMethod.apply(console, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user