Open page with information

-1

I have a FlatList and want to take the information that is in a click to open another page. As in the image in each item of the flat I put a TouchableOpacity and has a click action, I want to open a page with the information that is in that flat clicked.

    
asked by anonymous 09.08.2018 / 14:06

2 answers

0
  • Install react-navigation: react-navigation
  • Configure routes with the stackNavigator
  • Call the route in the item's onPress

    <TouchableOppacity onPress={() => this.props.navigation.push('Details', { itemId: Math.floor(Math.random() * 100), })} >

  • On the screen where you are receiving the route, take these parameters: const itemId = this.navigation.getParam('itemId')

09.08.2018 / 14:20
0

There are several ways to do this, all of them you will need StackNavigation 2V ... and to make the transition from one screen to another just create a file to configure the routes using the createStackNavigator ... and instead of your all pointing to this pg it will point to your route script, hence there you will configure for this screen to be the first to be loaded, then just decide what you want to send to the details screen, if you have a base local, I suggest sending only the object ID using this.props.navigation.navigate (, idDoItemClicado) ... then in the other pg vc using the componentDidMount () to be able to make a query when assembling the component and load the data that you want using or id.

    
10.08.2018 / 03:07