In my current use-case, I'm adding items to a ScrollView
. I noticed that if I add an item to the items collection located in state, all the items re-render.
Is there any workaround I can do?
The current implementation has to be ScrollView
, so changing to FlatList
or any other implementation of List would be irrelevant.
<View style={{flex: 1}}>
<ScrollView>
<TouchableWithoutFeedback accessible={false}>
<View style={{flexDirection: 'column', alignItems: 'center'}}>
{this.state.items.map(( item, key ) =>
(
<Flag country={item} key={key} />
))}
</View>
</TouchableWithoutFeedback>
</ScrollView>
</View>
Thank you