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

when I click FilmCinemaList, i wanna pass a params. how to use setParams?

Ann
  • 41
  • 4

2 Answers2

2

You can pass the params this way when rendering your AppTabs:

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

And you can access them on FilmCinemaList by:

this.props.screenProps.FilmCinemaList

.

nirsky
  • 2,955
  • 3
  • 22
  • 35
0

Through navigationOptions, what you have to do is to set the navigationOptions for the screen before pass it in the TabNavigator like the following:

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 ever you need to.

Hussam Kurd
  • 8,066
  • 2
  • 43
  • 38