From 638d672abc9eafa60c573ff515ba2cd3038828a4 Mon Sep 17 00:00:00 2001 From: Mido Date: Tue, 22 Jan 2019 07:02:16 -0800 Subject: [PATCH] Added groupCollapsed polyfill (#21457) Summary: `groupCollapsed` is used to group logs but collapsed which is very useful when the console has many logs (e.g. when using `redux-logger`). For developers who prefer to debug iOS apps using Safari JSC, the `groupCollapsed` was not polyfilled. Fixes #21446 Pull Request resolved: https://github.com/facebook/react-native/pull/21457 Differential Revision: D13761796 Pulled By: cpojer fbshipit-source-id: e7c4f1ff4728c6a7f6ffd6cc629f7fbc1aa67e87 --- Libraries/polyfills/console.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Libraries/polyfills/console.js b/Libraries/polyfills/console.js index 31533dd0b..7954bcfc0 100644 --- a/Libraries/polyfills/console.js +++ b/Libraries/polyfills/console.js @@ -509,6 +509,11 @@ function consoleGroupPolyfill(label) { groupStack.push(GROUP_PAD); } +function consoleGroupCollapsedPolyfill(label) { + global.nativeLoggingHook(groupFormat(GROUP_CLOSE, label), LOG_LEVELS.info); + groupStack.push(GROUP_PAD); +} + function consoleGroupEndPolyfill() { groupStack.pop(); global.nativeLoggingHook(groupFormat(GROUP_CLOSE), LOG_LEVELS.info); @@ -534,6 +539,7 @@ if (global.nativeLoggingHook) { table: consoleTablePolyfill, group: consoleGroupPolyfill, groupEnd: consoleGroupEndPolyfill, + groupCollapsed: consoleGroupCollapsedPolyfill, }; // If available, also call the original `console` method since that is