Search code snippets, questions, articles...

Get scrollview active index

const onScroll = (event) => {
  const scrollActiveIndex = Math.round(event.nativeEvent.contentOffset.x / wp(100));
  if (activeIndex !== scrollActiveIndex) {
      setState(scrollActiveIndex)
  }
};
Was this helpful?
0 Comments
Programming Feeds
Learn something new everyday on Devsheet