Skip to content

Commit 1f2c67d

Browse files
authored
Merge pull request #69 from byte-fe/develop
fix(debugger): console.group not exist on RN
2 parents 91f9371 + 8a44981 commit 1f2c67d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/helper.ts

+13
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ const initialProviderState: ProviderProps = {}
66
const GlobalContext = createContext(initialProviderState)
77
const Consumer = GlobalContext.Consumer
88

9+
// console.group polyfill
10+
if (!console.group) {
11+
const groups: any[] = []
12+
const hr = '-'.repeat(80) // 80 dashes row line
13+
console.group = function logGroupStart(label: any) {
14+
groups.push(label)
15+
console.log('%c \nBEGIN GROUP: %c', hr, label)
16+
console.groupEnd = function logGroupEnd() {
17+
console.log('END GROUP: %c\n%c', groups.pop(), hr)
18+
}
19+
}
20+
}
21+
922
const setPartialState = (
1023
name: keyof typeof Global.State,
1124
partialState: typeof Global.State | Function

0 commit comments

Comments
 (0)