question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why not use pagingEnabled and Animated.event

See original GitHub issue

I’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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kkemplecommented, Feb 8, 2018

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.

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!!

1reaction
zachgibsoncommented, Feb 8, 2018

because paging enabled is in relation to the scrollview window, not the children, so the scroll view width has to match 1:1 with the child width for that to work which makes most common carousel layouts very difficult

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found