Skip to content

Instantly share code, notes, and snippets.

@HERRKIN
Last active March 29, 2018 17:04
Show Gist options
  • Save HERRKIN/25b6b621e9be97ee297c18c3f2016022 to your computer and use it in GitHub Desktop.
Save HERRKIN/25b6b621e9be97ee297c18c3f2016022 to your computer and use it in GitHub Desktop.
linkTo action for drawer links
export default function* linkTo({ payload }) {
const { route, params } = payload
const action = ['Products', 'Configuration', 'Profile'].includes(route)
? NavigationActions.reset({
index: 0,
key: route,
actions: [NavigationActions.navigate({ routeName: route, params })],
})
: NavigationActions.navigate({ routeName: route, params })
yield put(action)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment