Skip to content

Commit b633cc1

Browse files
GijsWeteringsfacebook-github-bot
authored andcommitted
Remove console.disableYellowBox support
Summary: We're replacing console.disableYellowBox (untyped, global hack, only warnings) with LogBox.ignoreAllLogs() (typed, local method, handles errors and warnings). rickhanlonii made the initial deprecation of this >2 years ago in 87f1e22 . This diff finally removes the support of `console.disableYellowBox`. Users of LogBox should be using `LogBox.ignoreAllLogs`. This removal also allows us to move LogBox to strict mode flow. Changelog: [BREAKING] [Removed] Removed console.disableYellowBox in favor of LogBox.ignoreAllLogs. Reviewed By: rickhanlonii, yungsters Differential Revision: D34689343 fbshipit-source-id: 3b2865a4918de703e47cd722e3f396475254c65a
1 parent 5d5addd commit b633cc1

File tree

7 files changed

+7
-27
lines changed

7 files changed

+7
-27
lines changed

Libraries/Core/ExceptionsManager.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*
77
* @format
8-
* @flow strict-local
8+
* @flow strict
99
*/
1010

1111
'use strict';

Libraries/LogBox/Data/LogBoxData.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @flow strict-local
7+
* @flow strict
88
* @format
99
*/
1010

Libraries/LogBox/Data/LogBoxLog.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @flow strict-local
7+
* @flow strict
88
* @format
99
*/
1010

Libraries/LogBox/Data/LogBoxSymbolication.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @flow strict-local
7+
* @flow strict
88
* @format
99
*/
1010

Libraries/LogBox/Data/parseLogBoxLog.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @flow strict-local
7+
* @flow strict
88
* @format
99
*/
1010

Libraries/LogBox/LogBox.js

+2-21
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @flow
7+
* @flow strict
88
* @format
99
*/
1010

@@ -75,24 +75,6 @@ if (__DEV__) {
7575
consoleErrorImpl = registerError;
7676
consoleWarnImpl = registerWarning;
7777

78-
if ((console: any).disableYellowBox === true) {
79-
LogBoxData.setDisabled(true);
80-
console.warn(
81-
'console.disableYellowBox has been deprecated and will be removed in a future release. Please use LogBox.ignoreAllLogs(value) instead.',
82-
);
83-
}
84-
85-
(Object.defineProperty: any)(console, 'disableYellowBox', {
86-
configurable: true,
87-
get: () => LogBoxData.isDisabled(),
88-
set: value => {
89-
LogBoxData.setDisabled(value);
90-
console.warn(
91-
'console.disableYellowBox has been deprecated and will be removed in a future release. Please use LogBox.ignoreAllLogs(value) instead.',
92-
);
93-
},
94-
});
95-
9678
if (Platform.isTesting) {
9779
LogBoxData.setDisabled(true);
9880
}
@@ -115,7 +97,6 @@ if (__DEV__) {
11597
// After uninstalling: original > LogBox (noop) > OtherErrorHandler
11698
consoleErrorImpl = originalConsoleError;
11799
consoleWarnImpl = originalConsoleWarn;
118-
delete (console: any).disableLogBox;
119100
},
120101

121102
isInstalled(): boolean {
@@ -153,7 +134,7 @@ if (__DEV__) {
153134
return typeof args[0] === 'string' && args[0].startsWith('(ADVICE)');
154135
};
155136

156-
const isWarningModuleWarning = (...args: any) => {
137+
const isWarningModuleWarning = (...args: Array<mixed>) => {
157138
return typeof args[0] === 'string' && args[0].startsWith('Warning: ');
158139
};
159140

Libraries/LogBox/__tests__/LogBox-test.js

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ describe('LogBox', () => {
3737
console.error = jest.fn();
3838
console.log = jest.fn();
3939
console.warn = jest.fn();
40-
console.disableYellowBox = false;
4140
});
4241

4342
afterEach(() => {

0 commit comments

Comments
 (0)