Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 在React Native中获取touchableOpacity标记onPress的属性值_React Native - Fatal编程技术网

React native 在React Native中获取touchableOpacity标记onPress的属性值

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中一个接一个地列出我的项目,这样当用户触摸一个项目时,我就可以得到它的值

<TouchableOpacity key={12} lable='12' style={{margin:3}} onPress={() => this._helloXP(this.key)} >
this.\u helloXP(this.key)}>
我怎样才能做到这一点? 有没有办法通过按获取标记的属性值?
在上面的示例中,我想通过按获取键和标签值。

因为您已经为每个
onPress
创建了一个函数,所以您可以将这些道具传递给该函数

this.\u helloXP(12,'12')}>