Open page with information

Asked

Viewed 165 times

-1

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

flatlist exibida no celular

  • Hi, have you tried React-navigation?

2 answers

0

  • Install the React-navigation: React-navigation
  • Configure the routes with the stackNavigator
  • Call the route in the item 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')

  • As for the route or ta redirect of good, I want to take the information from the clicked list

  • @lyestah I edited to become clearer, anything comment!

0

There are many ways to do this, all of them will need Stacknavigation 2V ... and to make the transition from one screen to another just create a file to configure the routes using createStackNavigator ... and instead of your whole point to this pg it will point to your route script, there you will configure for this screen to be the first to be loaded, then just decide what you want to send to the detail screen, if you have a local base, I suggest sending only the ID of the object using this.props.navigation.navigate(,idDoItemClicate) ... dai na outra pg vc usando o componentDidMount() para poder fazer uma query ao montar o componente e carregar os dados que deseja utilizando o id.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.