OnPress访问元素的数据

时间:2018-02-22 20:04:25

标签: javascript react-native ecmascript-6

嘿,我真的坚持了这个问题。我按下它后,无法解决如何获取TouchableHighlight的数据。正在从数组中分配数据。

class Request extends Component {

constructor(props){
    super(props);
    this.Clicked = this.Clicked.bind(this)
}

Clicked = () => {
    //console.log(WhatIneed);
};

GetIt = () => {
    return this.state.ArrData.map((MyData) => (
       <View>
          <TouchableHighlight WhatIneed={MyData.ArrVal} onPress={() => {
              this.Clicked();
              }}>
             <Text>Button</Text>
          </TouchableHighlight>
        </View>
      ))
   };
}

0 个答案:

没有答案