Skip to content

Instantly share code, notes, and snippets.

@sejas
Created March 19, 2021 12:54
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 sejas/9df57fc516602dc4354865d9707d28f8 to your computer and use it in GitHub Desktop.
Save sejas/9df57fc516602dc4354865d9707d28f8 to your computer and use it in GitHub Desktop.
Tron Custom Command to Navigate to screen on React Native
// Navigation
Tron.onCustomCommand({
title: 'Choose your NAVIGATION',
description: 'Insert the screenName where you want to Navigate to.',
command: 'navigateTo',
args: [
{
name: 'screenName',
type: 'string',
},
] as CustomCommandArg[],
handler: ({ screenName }) => {
if (screenName) {
console.tron.log('Reactotron navigateTo: ' + screenName)
RootNavigation.navigate(screenName)
} else {
console.tron.log('resetting navigation store')
RootNavigation.resetRoot({ routes: [] })
}
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment