Browse Source

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

master
Lyubo Marinov 8 years ago
parent
commit
964061fa5c
1 changed files with 17 additions and 0 deletions
  1. 17
    0
      react/features/base/lib-jitsi-meet/native/polyfills-browser.js

+ 17
- 0
react/features/base/lib-jitsi-meet/native/polyfills-browser.js View File

@@ -235,6 +235,23 @@ function _visitNode(node, callback) {
235 235
 
236 236
                     if (typeof consoleLog === 'function') {
237 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 255
                             const { length } = args;
239 256
 
240 257
                             for (let i = 0; i < length; ++i) {

Loading…
Cancel
Save