Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

Make React Native FlatList item on center always active

$
0
0

Hello! I triyng to complete the functionality displayed on pinned image. I have done this with FlatList's onScroll event, but it change value to slow, active item not always at the middle. Is this some way to always give styles to item, which is on center? Below is my scroll handler.

const onScroll = (event) => {   const { y } = event.nativeEvent.contentOffset;   const { height: layoutHeight } = event.nativeEvent.layoutMeasurement;   const value = Math.floor(y / itemHeight) + Math.floor(layoutHeight / itemHeight / 2);   if (activeItem !== value) {      setActiveItem(value);   }   }

Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>