如何呈现在flatlist按键反应母语?

问题描述 投票:1回答:1

我有我想要的flatlist使其迭代,并显示多次作为一个列表来呈现两个按钮。我应该怎么办呢?

<FlatList
  data={this.state.data}
  extraData={this.state}
  renderItem={this.renderItem}
  keyExtractor={items => items.id}
/>
<TouchableOpacity onPress={this.onPressButtonPlay.bind(this)}>
  <Text style={styles.buttonText}> </Text>
</TouchableOpacity>

<TouchableOpacity onPress={this.onPressButtonPause.bind(this)}>
  <Text style={styles.buttonText}>{this.state.pause ? 'Resume' : 'Pause'}</Text>
</TouchableOpacity>
react-native components react-native-ios react-native-flatlist
1个回答
0
投票

只需在您的renderItem函数中插入:

renderItem = ({item}) => {
  return(
      <TouchableWithoutFeedback>
        <TouchableOpacity>
            {this.renderButton()}
        </TouchableOpacity>
      <TouchableWithoutFeedback>
  );
}
© www.soinside.com 2019 - 2024. All rights reserved.