Skip to content

Instantly share code, notes, and snippets.

@ajiehatajie
Created January 25, 2018 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajiehatajie/590314691b5b6a945d5aa8b8a702e02e to your computer and use it in GitHub Desktop.
Save ajiehatajie/590314691b5b6a945d5aa8b8a702e02e to your computer and use it in GitHub Desktop.
konfiguasi ReactToTron react native konsole log
import Reactotron, {
trackGlobalErrors,
openInEditor,
overlay,
asyncStorage,
networking
} from 'reactotron-react-native'
Reactotron
.configure({
name: 'Connect React Native Ktpelmu'
})
.use(trackGlobalErrors())
.use(openInEditor())
.use(overlay())
.use(asyncStorage())
.use(networking())
.connect()
// swizzle the old one
const yeOldeConsoleLog = console.log
// make a new one
console.log = (...args) => {
// always call the old one, because React Native does magic swizzling too
yeOldeConsoleLog(...args)
// send this off to Reactotron.
Reactotron.display({
name: 'CONSOLE.LOG',
value: args,
preview: args.length > 0 && typeof args[0] === 'string' ? args[0] : null
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment