Created
April 29, 2020 16:43
-
-
Save sobstel/515e8ece6e5e26d843c4f02c8bc42bff to your computer and use it in GitHub Desktop.
React Navigation (v4) sequential navigator
This file contains hidden or 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
import React from 'react'; | |
import { withMappedNavigationProps } from 'react-navigation-props-mapper'; | |
import { createSequentialNavigator } from './createSequentialNavigator'; | |
import { ReviewRating, ReviewText } from './screens/review'; | |
const ReviewStack = createSequentialNavigator( | |
{ | |
ReviewRating: { | |
screen: withMappedNavigationProps()(ReviewRating), | |
}, | |
ReviewText: { | |
screen: withMappedNavigationProps()(ReviewText), | |
}, | |
}, | |
{ | |
initialRouteName: 'ReviewRating', | |
defaultNavigationOptions: { | |
title: "Submit Your Review", | |
}, | |
sequentialNavigationOptions: { | |
order: navigation => { | |
if (navigation.getParam('onlyRaring')) { | |
return ['ReviewRating']; | |
} | |
return [ | |
'ReviewRating', | |
'ReviewText', | |
]; | |
}, | |
}, | |
}, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment