Selaa lähdekoodia

[RN] Make it easier to disable yellow and red boxes in Debug

master
Lyubo Marinov 8 vuotta sitten
vanhempi
commit
964061fa5c

+ 17
- 0
react/features/base/lib-jitsi-meet/native/polyfills-browser.js Näytä tiedosto

235
 
235
 
236
                     if (typeof consoleLog === 'function') {
236
                     if (typeof consoleLog === 'function') {
237
                         console[level] = function(...args) {
237
                         console[level] = function(...args) {
238
+                            // XXX If console's disableYellowBox is truthy, then
239
+                            // react-native will not automatically display the
240
+                            // yellow box for the warn level. However, it will
241
+                            // still display the red box for the error level.
242
+                            // But I disable the yellow box when I don't want to
243
+                            // have react-native automatically show me the
244
+                            // console's output just like in the Release build
245
+                            // configuration. Because I didn't find a way to
246
+                            // disable the red box, downgrade the error level to
247
+                            // warn. The red box will still be displayed but not
248
+                            // for the error level.
249
+                            if (console.disableYellowBox && level === 'error') {
250
+                                console.warn(...args);
251
+
252
+                                return;
253
+                            }
254
+
238
                             const { length } = args;
255
                             const { length } = args;
239
 
256
 
240
                             for (let i = 0; i < length; ++i) {
257
                             for (let i = 0; i < length; ++i) {

Loading…
Peruuta
Tallenna