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

Expose some field so we could disable the "bounce" when reaching end of carousel #572

Open
bozha-step opened this issue Mar 20, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@bozha-step
Copy link

Is your feature request related to a problem? Please describe.
I feel it's useful if we could provide sth like the React Native ScrollView bounces

Describe the solution you'd like
Some time we don't want the user see the blank background when scroll over the carousel "edges", disable the scroll over behavior would be useful in such case.

@bozha-step bozha-step added the enhancement New feature or request label Mar 20, 2024
@bozha-step bozha-step changed the title Expose field so we could disable the "bounce" when reaching end of carousel Expose some field so we could disable the "bounce" when reaching end of carousel Mar 20, 2024
Copy link

dosubot bot commented Mar 20, 2024

Based on the information provided, it seems that the react-native-reanimated-carousel component does have a prop named overscrollEnabled that controls whether the carousel allows scrolling beyond its content bounds. When overscrollEnabled is false, the carousel restricts scrolling to the limits of its content, effectively disabling the overscroll or "bounce" effect. This behavior is particularly evident in the getLimit function and the withProcessTranslation function, where the scroll limit and translation adjustments are conditionally applied based on the value of overscrollEnabled.

However, there are open issues in the repository that suggest that the overscrollEnabled prop might not be working as expected in some cases. For example, the issue overscrollEnabled={false} not respected when using next and previous buttons indicates that the prop might not be respected when using the next and previous buttons. Similarly, the issue [question] Is it possible to disable the overscroll? suggests that there is no clear consensus on a solution to disable overscroll at the ends of the carousel.

Given this, it seems that the overscrollEnabled prop should theoretically provide the functionality you're looking for, but there might be some issues with its current implementation. You might want to keep an eye on the open issues related to this prop for any updates or fixes.

As for the current behavior of the carousel when reaching the end of the content, it depends on the loop prop. If the loop prop is set to true, the carousel will loop back to the beginning or end (depending on the direction of navigation) when it reaches the end of the content, creating an infinite loop effect. If loop is false, the carousel will stop abruptly when it reaches the end of the content, without looping back.

I hope this information helps! If you have any other questions or need further clarification, feel free to ask.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@bozha-step
Copy link
Author

Similar request here: #320.

@TowhidKashem
Copy link

@bozha-step were you able to find a way to do this? I tried to mess around in the source files but it uses some complex logic in ScrollViewGesture.tsx instead of a normal scroll view import from react-native so I couldn't get it done..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants