Created
March 19, 2021 12:54
-
-
Save sejas/9df57fc516602dc4354865d9707d28f8 to your computer and use it in GitHub Desktop.
Tron Custom Command to Navigate to screen on React Native
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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