从列表视图中获取要发送的值React-Native

时间:2017-04-04 15:52:52

标签: listview react-native

我在获取listview的值然后发送它们时遇到问题。

这是一个评级系统(RatingBar),我想获得每个项目的名称和评级。

由于

1 个答案:

答案 0 :(得分:0)

    <ListView>
    renderRow={(rowData, sec, i) =>
            (
             // you can use button or any other click event here
             <TouchableHighlight
            activeOpacity={75 / 100}
            underlayColor={'rgb(210,210,210)'}
            onPress={() => {
              // You can get value like:
              rowData.name
              // Set them in a state to use anywhere or pass to function from here itself. set state example
              this.setState({
                   name: rowData.name,
              })
            }}
          >

          </TouchableHighlight>
            )

    </ListView>