React-native-snap-carousel: Add option to limit number of scrolled items to 1

Created on 28 Mar 2018  路  5Comments  路  Source: meliorence/react-native-snap-carousel

Is this a bug report or a feature request?

Feature Request

Have you read the guidelines regarding bug report?

Yes

Have you read the documentation in its entirety?

Yes

Description

would be great to enable a mode where users only fling one element at a time: no matter how quick the gesture is, only the next element should be centered.
Maybe this is already possible but I haven't found it anywhere in the documentation or the examples.

enhancement help wanted react-native bug

All 5 comments

Hi @marcmo,

Prop lockScrollWhileSnapping should help with that. Also, make sure to test in a production environment.

To provide a bit more context about why this is not an easy thing to accomplish, you need to know that despite being one of the most wanted feature, the React Native team have not implement yet a proper equivalent of the iOS snapToAlignment/snapToInterval combo on Android. Therefore, we are left with a bunch of hacks, workarounds and debug mode issues... I've done my best to tackle it, but some core things are either missing or buggy and I have no control at all over it.

Still, ideas and PR are always welcome ;-)

thanks for the fast reply @bd-arc ...yes I know about the snapToInterval issue in Android...a pity! that's actually the reason I tried your library ;)
I understand that this is not an issue that might not be easy to accomplish so I will close it for now.
I did try your lockScrollWhileSnapping property but had no success (still able to scroll more than 1 item when flinging).

Could we keep this open in case someone else has an alternative solution, I really need this for a project I'm working on :P

@CodeLuca Sure, but don't get your hopes too high for now ;-)

Unless the Facebook team implement a proper snapToInterval on Android and make the ScrollView component behave properly on this OS, we're kind of stuck...

FYI, I've been thinking about implementing a custom PanResponder on top of the FlatList to see if I can anyhow get the best of both worlds, but this is more work than I can handle at the moment...

@marcmo @CodeLuca Hi, do you have any solutions ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

siderakis picture siderakis  路  3Comments

NikitaNeganov picture NikitaNeganov  路  3Comments

sujitpk-perennial picture sujitpk-perennial  路  3Comments

AndrePech picture AndrePech  路  4Comments

amyogiji picture amyogiji  路  5Comments