简体   繁体   English

如何在 React Native 中创建新页面?

[英]How to create new page in React Native?

My app displayed a grid of pokemons, I have retrieved the data from axios and fed it to a FlatList in React Native (Below)我的应用程序显示了一个 pokemons 网格,我从 axios 检索了数据并将其输入到 React Native 中的 FlatList(如下)

在此处输入图片说明

I want each of these pokemons to be buttons which leads to the next page (Below)我希望这些口袋妖怪中的每一个都是通向下一页的按钮(下)

在此处输入图片说明

I have no idea on how to do this.我不知道如何做到这一点。 I'm assuming I have to create an 'onPress' function inside the Flatlist?我假设我必须在 Flatlist 中创建一个“onPress”函数? Or React routing but not sure could someone shed some light into this?或者 React 路由,但不确定有人能对此有所了解吗?

Thanks谢谢

Basically, you need a lib to do that.基本上,你需要一个库来做到这一点。 I've been using React Navigation.我一直在使用 React Navigation。 You can follow its tutorial here https://reactnavigation.org/docs/hello-react-navigation您可以在此处遵循其教程https://reactnavigation.org/docs/hello-react-navigation

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM