@@ -46,6 +46,10 @@ if (__DEV__) {
46
46
LogBoxData. addIgnorePatterns ( patterns ) ;
47
47
} ,
48
48
49
+ ignoreAllLogs : ( value ?: ?boolean ) : void => {
50
+ LogBoxData . setDisabled ( ! ! value ) ;
51
+ } ,
52
+
49
53
uninstall : ( ) : void => {
50
54
errorImpl = error ;
51
55
warnImpl = warn ;
@@ -64,18 +68,26 @@ if (__DEV__) {
64
68
registerWarning ( ...args ) ;
65
69
} ;
66
70
67
- if ( ( console : any ) . disableLogBox === true ) {
71
+ if ( ( console : any ) . disableYellowBox === true ) {
68
72
LogBoxData . setDisabled ( true ) ;
73
+ console . warn (
74
+ 'console.disableYellowBox has been deprecated and will be removed in a future release. Please use LogBox.ignoreAllLogs(value) instead.' ,
75
+ ) ;
69
76
}
70
77
71
- ( Object . defineProperty : any ) ( console , 'disableLogBox ' , {
78
+ ( Object . defineProperty : any ) ( console , 'disableYellowBox ' , {
72
79
configurable : true ,
73
80
get : ( ) => LogBoxData . isDisabled ( ) ,
74
- set : value => LogBoxData . setDisabled ( value ) ,
81
+ set : value => {
82
+ LogBoxData . setDisabled ( value ) ;
83
+ console . warn (
84
+ 'console.disableYellowBox has been deprecated and will be removed in a future release. Please use LogBox.ignoreAllLogs(value) instead.' ,
85
+ ) ;
86
+ } ,
75
87
} ) ;
76
88
77
89
if ( Platform . isTesting ) {
78
- ( console : any ) . disableLogBox = true ;
90
+ LogBoxData . setDisabled ( true ) ;
79
91
}
80
92
81
93
RCTLog . setWarningHandler ( ( ...args ) => {
@@ -171,6 +183,10 @@ if (__DEV__) {
171
183
// Do nothing.
172
184
} ,
173
185
186
+ ignoreAllLogs : ( value ?: ?boolean ) : void => {
187
+ // Do nothing.
188
+ } ,
189
+
174
190
install : ( ) : void => {
175
191
// Do nothing.
176
192
} ,
@@ -185,6 +201,7 @@ module.exports = (LogBox: {
185
201
// TODO: deprecated, replace with ignoreLogs
186
202
ignoreWarnings ( $ReadOnlyArray < IgnorePattern > ) : void ,
187
203
ignoreLogs ( $ReadOnlyArray < IgnorePattern > ) : void ,
204
+ ignoreAllLogs ( ?boolean ) : void ,
188
205
install ( ) : void ,
189
206
uninstall ( ) : void ,
190
207
...
0 commit comments