FlatList项目始终获取最后一个项目

时间:2018-09-20 10:01:04

标签: javascript react-native

我的FlatList有一个:

renderItem={({item, index}) => this.showItem(item, index)}

现在我的showItem返回:

showItem = (item,index) => {
  return(
    <View>
      <Text>{index}</Text>
      <Button onPress={this.showModal(index)}></Button>
    </View>
  )}

现在我总是在堆栈的顶部渲染索引为“ 4”的5个模态,但每个项目列表中的索引文本都是正确的,

如何显示具有正确索引的1个模态?

0 个答案:

没有答案
相关问题