react-native-pager
react-native-pager copied to clipboard
feat: add velocity to spring animation
This PR adds support for momentum scrolling by taking into account the velocity when drag is released into the spring animation.
this is great -- thanks so much! i'll run a few tests and merge this if all is well 👍
my only issue with this is that its super sensitive to numberOfPages -- a quick swipe can move the index +/- ~15 pages. i wonder if theres a default coefficient for handling this kind of thing...or perhaps clamping the number of pages moved?
@ajsmth I added a parameter velocityMultiplier
to control how much you want it to scroll. let me know if it works!
updated the PR to work with v0.2
U don't want to add this @ajsmth? It's such a great library and needs some more love :)
hey - i would love to add this but it’s always broken existing functionality when i’ve tested it. i will take some time to try and add it if it’s something people want.
rn-reanimated is coming out with some major improvements soon, perhaps i will wait for the next release and do a proper overhaul of this lib
Sounds great. I was trying to optimize the lib on android (because its not working super great on it) using react-native-screens. Not sure if its possible and if there is a big improvement but maybe moving it to native containers might help to boost it (just as a thought)
thanks, i’ll keep it in mind. i’m quite familiar with rn-screens as well. i suspect some of the android issues will be addressed as they are supposedly moving more of the lib to the native thread. we’ll see
Crossing fingers reanimated drops soon enough before Expo SDK 38 lands :D
looks like it was released today: https://blog.swmansion.com/introducing-reanimated-2-752b913af8b3
i'll be looking at improving this lib
Crazy news! Please don't drop too many BCs :D
Limitations are pretty high atm: https://docs.swmansion.com/react-native-reanimated/docs/about
I think its to early to adopt to Reanimated2 - its also Hermes only for android. (which expo does not support currently) Your improvements might lead to a new major version imho.