Search code snippets, questions, articles...

Scroll View Pagination

const scrollX = useRef(new Animated.Value(0)).current;
 
 
<ScrollView
        scrollEnabled={enableScroll}
        horizontal={true}
        pagingEnabled
        showsHorizontalScrollIndicator={false}
        onScroll={Animated.event(
          [
            {
              nativeEvent: {
                contentOffset: {
                  x: scrollX,
                },
              },
            },
          ],
          { useNativeDriver: false },
        )}
        scrollEventThrottle={1}>

</ScrollView>
Was this helpful?
0 Comments
Programming Feeds
Learn something new everyday on Devsheet