Maintain state.params between react-navigation tabs
I am creating an app with react-react and react. The problem is that when I go to the TabNavigator view, switching between tabs erases the navigation options for the TabNavigator scene. I want to keep the same navigation options for all tabs.
Here is my setup. It starts with Home
TabNavigator. If they click on a person PeopleList
, then I move on to Person
TabNavigator, calling: this.props.navigation.navigate("Person",{person:person})
. This defaults to the scene Info
correctly with the correct parameters. However, when I click on the tab PersonPurchases
, the parameter Person
is removed from the nav state.
const MyApp = StackNavigator({
Home: {screen:TabNavigator({
PeopleList: { screen: PeopleListScene },
Calendar: { screen: CalendarScene },
TasksList: { screen: TasksScene },
})},
Person: {screen:TabNavigator({
PersonInfo: { screen: PersonInfoScene },
PersonPurchases: { screen: PersonPurchasesScene }
},{tabBarOptions:{ tabBarPosition:"bottom", backBehavior:"none"})}
})
Any idea how to prevent this?
source to share
No one has answered this question yet
Check out similar questions: