React native 在React Native中获取touchableOpacity标记onPress的属性值
我是新来的,我有个问题。我想创建自己的选择器。 所以我试着在TouchableOpacity中一个接一个地列出我的项目,这样当用户触摸一个项目时,我就可以得到它的值React native 在React Native中获取touchableOpacity标记onPress的属性值,react-native,React Native,我是新来的,我有个问题。我想创建自己的选择器。 所以我试着在TouchableOpacity中一个接一个地列出我的项目,这样当用户触摸一个项目时,我就可以得到它的值 <TouchableOpacity key={12} lable='12' style={{margin:3}} onPress={() => this._helloXP(this.key)} > this.\u helloXP(this.key)}> 我怎样才能做到这一点? 有没有办法通过按获取标记的属性值?
<TouchableOpacity key={12} lable='12' style={{margin:3}} onPress={() => this._helloXP(this.key)} >
this.\u helloXP(this.key)}>
我怎样才能做到这一点?
有没有办法通过按获取标记的属性值?
在上面的示例中,我想通过按获取键和标签值。因为您已经为每个
onPress
创建了一个函数,所以您可以将这些道具传递给该函数
this.\u helloXP(12,'12')}>