【发布时间】:2018-11-01 06:19:44
【问题描述】:
我正在使用来自 react native elements 的 react native Flatlist。 我想要做的是当我点击每一行时,我想导航到一个新屏幕并获取详细信息。
例如,如果我点击AmyFarha,我想在新屏幕中访问她的email 和phoneNumber。
下面是代码。我添加了电子邮件和电话号码字段。
import { List, ListItem } from 'react-native-elements'
const list = [
{
name: 'Amy Farha',
avatar_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/ladylexy/128.jpg',
subtitle: 'Vice President',
email: 'amy@amy.com',
phoneNumber: '1-808-9999'
},
{
name: 'Chris Jackson',
avatar_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/adhamdannaway/128.jpg',
subtitle: 'Vice Chairman',
email: 'chris@chris.com',
phoneNumber: '1-808-8888'
},
... // more items
]
<List containerStyle={{marginBottom: 20}}>
{
list.map((l) => (
<ListItem
roundAvatar
avatar={{uri:l.avatar_url}}
key={l.name}
title={l.name}
/>
))
}
</List>
【问题讨论】:
-
你为什么不用touchablehighlight
-
您使用的是什么导航?
-
@Nima createDrawerNavigator 和 createStackNavigator 有关系吗?
标签: javascript reactjs react-native react-native-flatlist