Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to limit number of scrolled items to 1 #296

Open
marcmo opened this issue Mar 28, 2018 · 8 comments
Open

Add option to limit number of scrolled items to 1 #296

marcmo opened this issue Mar 28, 2018 · 8 comments

Comments

@marcmo
Copy link

marcmo commented Mar 28, 2018

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.

@bd-arc
Copy link
Contributor

bd-arc commented Mar 28, 2018

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 ;-)

@marcmo
Copy link
Author

marcmo commented Mar 29, 2018

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).

@marcmo marcmo closed this as completed Mar 29, 2018
@CodeLuca
Copy link

CodeLuca commented Apr 7, 2018

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

@bd-arc
Copy link
Contributor

bd-arc commented Apr 8, 2018

@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...

@cuitianze
Copy link

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

@vladlenskiy
Copy link

@bd-arc Any new solutions or ideas?
I have this problem on Android :(

@dohooo

This comment was marked as spam.

@comvenger-brandon
Copy link

comvenger-brandon commented Jul 5, 2022

For everyone still looking for a solution.

Use those properties from ScrollView, worked wonders for me.

disableIntervalMomentum
pagingEnabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants