Why not use pagingEnabled and Animated.event
See original GitHub issueI’m curious, why didn’t you choose to use the prop pagingEnabled
on FlatList
for snapping? Also why not use Animated.event
and leverage useNativeDriver
instead of setValue
for mapping your Animated.Value
?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
React Native ScrollView not paginating in a perfectly aligned ...
Any ScrollView 's props should work on FlatList , including pagingEnabled . You can achieve a horizontal list with pagination by using ......
Read more >Linking Animations to Scroll Position in React Native - Medium
So let's use the not-yet-documented useNativeDriver flag that's passed as second argument on the Animated.event call. const onScroll = Animated.
Read more >Animations - React Native
Gestures, like panning or scrolling, and other events can map directly to animated values using Animated.event .
Read more >react-native-animated-pagination-dots - npm
Gestures, like panning or scrolling, and other events can map directly to animated values using Animated.event(). For example, when working with ...
Read more >Reanimated 2 Events (part II) — Scroll Events
An alternative approach would be to use pagingEnabled prop available ... events, not only onScroll, exactly like useAnimatedScrollHandler, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I completely agree but we have to support large tablet devices and some items in carousel are max 250 dp wide which gets really hard to manage and requires a bit of work around! The other issue is some data sets are quite large and having to swipe through without velocity would get very tedious.
Thanks so much for the brainstorming sesh and love your work in RN eco-system!!
This isn’t totally true, but your issue is. Paging enabled will snap to multiples of the scroll view’s size, independent of children. You can achieve the peeking carousel items but the scroll view has to be less width than device width, centered, and overflow set to visible. This works except the edges are no longer scrollable.
Anyways, just wanted to bring up a couple of these things to try and help. Good job on the lightweight carousel!