I have a Swiper implemented in my react native project (react-native-swiper), which I plan to show data along with pagination guides. While the swiper is working, I'm having an issue creating a consistent key - right now if one of the objects in the swiper list updates it may offset the index. While I've been able to prevent such glitches by adding a unique key on the objects, the Swiper pagination however is not in sync. The former key gets its data from mapping the list, but the Swiper object is on the outer scope so it's not able to use that identifier. I've attached the code for reference. Please let me know if I can set a key that ensures stable changes and correct pagination. Thank you.
<Swiper
key={data.length} //This is the key that enables correct pagination currently
paginationStyle={{bottom: -20}}
height={330}
dot={<View style={styles.Dot} />}
activeDot={<View style={styles.ActiveDot} />}
>
{data.map((dataX, index) => {
return (
<View key={dataX.uniqueToken}> //This (or the index) is the key I'd like to use on the Swiper element
... stuff to show images, etc.
</View>
)
})}
</Swiper>