In TabNavigator interactive navigation how to set up Params

const AppTabs = TabNavigator({
Home: {
  screen: FilmList,
},
FilmCinemaList: {
  screen: FilmCinemaList,
  path: 'cart',
},
FilmGoodsList: {
    screen: FilmGoodsList,
},
FilmMe: {
    screen: FilmMe,
},
})

      

when i click on FilmCinemaList i want to pass parameters. how to use setParams?

+3


source to share


2 answers


You can pass parameters this way when rendering AppTabs:

<AppTabs screenProps={{ FilmCinemaList: { ...yourParams } }}/>

      

And you can access them in the FilmCinemaList:



this.props.screenProps.FilmCinemaList

      

...

+1


source


Through navigationOptions you need to set the navigation for the screen before passing it to the TabNavigator as shown below:

FilmCinemaList.navigationOptions = {
 'param1':'value1';
};
const AppTabs = TabNavigator({
Home: {
  screen: FilmList,
},
FilmCinemaList: {
  screen: FilmCinemaList,
  path: 'cart',
},
FilmGoodsList: {
    screen: FilmGoodsList,
},
FilmMe: {
    screen: FilmMe,
},
})

      

And then you can access it



FilmCinemaList.navigationOptions.param1

      

When you need it.

0


source







All Articles