I have FlatList element:
<FlatList
ref={listRef}
data={data}
onLayout={_onLayoutDimensionsChanged}
keyExtractor={_keyExtractor}
renderItem={_renderItem}
initialScrollIndex={initialScrollIndex}
onViewableItemsChanged={onViewableItemsChanged}
viewabilityConfig={{ itemVisiblePercentThreshold: 50 }}
ItemSeparatorComponent={ItemSeparator}
snapToInterval={totalItemWidth}
decelerationRate={0.0}
getItemLayout={(data, index) => ({
length: totalItemWidth,
offset: totalItemWidth * index,
index
})}
initialNumToRender={2}
showsHorizontalScrollIndicator={false}
removeClippedSubviews
bounces
horizontal
/>
Where totalItemWidth is:
totalItemWidth = itemsWidth + SEPARATOR_SIZE;
I would like to achieve that swipe gesture will move one item at maximum but even with deceleration rate set to decelerationRate={0.0} my list is swiping even 2 items if I swipe with my fingers little bit faster than normal swipe's speed is.
Is there any way to prevent double-swipe there? I'm implementing Image Gallery so it is not very user-friendly when a user can swipe two photos at once.
Thank you so much!