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

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

问题描述:

我有一个问题,得到一个列表视图的值,然后发送它们。从列表视图中获取值发送React-Native

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

感谢

+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>