cesardeazevedo / react-native-nested-scroll-view

react-native wrapper for android NestedScrollView
MIT License
88 stars 36 forks source link

Warning: Each child in an array or iterator should have a unique key prop. #2

Closed Angelk90 closed 7 years ago

Angelk90 commented 7 years ago

I tried this way:

          <FlatList
            keyExtractor={(item, index) => item.id}
            data={this.state.data}
            renderItem={this.renderBox}
            renderScrollComponent={this.renderScroll}
          />

  renderBox(item) {
      <TouchableOpacity key={item.index} underlayColor="transparent" activeOpacity={1}>
        <View style={styles.box}>
.....
        </View>
      </TouchableOpacity>
}

@cesardeazevedo: But it does not work, how can I fix it? I also printed on the renderBox function: console.log (item), I remember printing the data twice, that is, dropping them, can it be?

cesardeazevedo commented 7 years ago

I don't know what's going on with your code, so I am not sure how to help, but you don't need to pass the key={item.index} with FlatList, the keyExtractor would be enough with keyExtractor={(item) => item.index}

i don't see this issue related to react-native-nested-scroll-view, so i am going to close it.