@react-navigation/devtools
Advanced tools
Comparing version 7.0.0 to 7.0.1
@@ -9,10 +9,13 @@ "use strict"; | ||
function useLogger(ref) { | ||
const actionColor = '#C2185B'; | ||
const keyColor = '#43A047'; | ||
const valueColor = '#1E88E5'; | ||
(0, _useDevToolsBase.useDevToolsBase)(ref, result => { | ||
const log = [[`${result.type} `, 'color: gray; font-weight: lighter']]; | ||
if (result.type === 'action') { | ||
log.push([`${result.action.type} `, 'color: black; font-weight: bold']); | ||
log.push([`${result.action.type} `, `color: ${actionColor}; font-weight: bold`]); | ||
const payload = result.action.payload; | ||
if (payload && Object.keys(payload).length > 0) { | ||
log.push(['{ ', 'color: gray; font-weight: lighter'], ...Object.entries(payload).map(([key, value], i, self) => { | ||
const pair = [[key, 'color: green; font-weight: normal'], [': ', 'color: gray; font-weight: lighter'], [JSON.stringify(value), 'color: blue; font-weight: normal']]; | ||
const pair = [[key, `color: ${keyColor}; font-weight: normal`], [': ', 'color: gray; font-weight: lighter'], [JSON.stringify(value), `color: ${valueColor}; font-weight: normal`]]; | ||
if (i < self.length - 1) { | ||
@@ -34,6 +37,6 @@ pair.push([', ', 'color: gray; font-weight: lighter']); | ||
if (typeof value === 'string') { | ||
console.log(`%cstack`, 'color: black; font-weight: bold', `\n${value.split('\n').map(line => line.trim()).join('\n')}`); | ||
console.log(`%cstack`, `color: ${actionColor}; font-weight: bold`, `\n${value.split('\n').map(line => line.trim()).join('\n')}`); | ||
} | ||
} else if (key !== 'type') { | ||
console.log(`%c${key}`, 'color: black; font-weight: bold', value); | ||
console.log(`%c${key}`, `color: ${actionColor}; font-weight: bold`, value); | ||
} | ||
@@ -40,0 +43,0 @@ }); |
@@ -5,10 +5,13 @@ "use strict"; | ||
export function useLogger(ref) { | ||
const actionColor = '#C2185B'; | ||
const keyColor = '#43A047'; | ||
const valueColor = '#1E88E5'; | ||
useDevToolsBase(ref, result => { | ||
const log = [[`${result.type} `, 'color: gray; font-weight: lighter']]; | ||
if (result.type === 'action') { | ||
log.push([`${result.action.type} `, 'color: black; font-weight: bold']); | ||
log.push([`${result.action.type} `, `color: ${actionColor}; font-weight: bold`]); | ||
const payload = result.action.payload; | ||
if (payload && Object.keys(payload).length > 0) { | ||
log.push(['{ ', 'color: gray; font-weight: lighter'], ...Object.entries(payload).map(([key, value], i, self) => { | ||
const pair = [[key, 'color: green; font-weight: normal'], [': ', 'color: gray; font-weight: lighter'], [JSON.stringify(value), 'color: blue; font-weight: normal']]; | ||
const pair = [[key, `color: ${keyColor}; font-weight: normal`], [': ', 'color: gray; font-weight: lighter'], [JSON.stringify(value), `color: ${valueColor}; font-weight: normal`]]; | ||
if (i < self.length - 1) { | ||
@@ -30,6 +33,6 @@ pair.push([', ', 'color: gray; font-weight: lighter']); | ||
if (typeof value === 'string') { | ||
console.log(`%cstack`, 'color: black; font-weight: bold', `\n${value.split('\n').map(line => line.trim()).join('\n')}`); | ||
console.log(`%cstack`, `color: ${actionColor}; font-weight: bold`, `\n${value.split('\n').map(line => line.trim()).join('\n')}`); | ||
} | ||
} else if (key !== 'type') { | ||
console.log(`%c${key}`, 'color: black; font-weight: bold', value); | ||
console.log(`%c${key}`, `color: ${actionColor}; font-weight: bold`, value); | ||
} | ||
@@ -36,0 +39,0 @@ }); |
{ | ||
"name": "@react-navigation/devtools", | ||
"description": "Developer tools for React Navigation", | ||
"version": "7.0.0", | ||
"version": "7.0.1", | ||
"keywords": [ | ||
@@ -90,3 +90,3 @@ "react", | ||
}, | ||
"gitHead": "25964f799b3abe103a58e2e321790cfa85e4067b" | ||
"gitHead": "10d8beb6a843d7f5c8585cae9d81b7c29e2fed2b" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
185144
1329