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

minScrollDistancePerSwipe not available but documentaion it is showing #578

Open
maghamvinod opened this issue Mar 27, 2024 · 2 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@maghamvinod
Copy link

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@maghamvinod maghamvinod added the enhancement New feature or request label Mar 27, 2024
Copy link

dosubot bot commented Mar 27, 2024

Hey there, @maghamvinod! 👋 Great to see you back here. How's everything going on your end?

Based on the context provided, the minScrollDistancePerSwipe property is indeed implemented in the react-native-reanimated-carousel v3.5.1 codebase. This property defines the minimum offset value required for a swipe action to trigger a scroll in the carousel. If the swipe translation is less than this value, the carousel will not scroll.

Here is the relevant code snippet from the onGestureEnd callback function in the ScrollViewGesture.tsx file:

else if (
  minScrollDistancePerSwipeIsSet && Math.abs(totalTranslation) < minScrollDistancePerSwipe
) {
  const nextPage = Math.round((panOffset.value + minScrollDistancePerSwipe * Math.sign(totalTranslation)) / size) * size;
  translation.value = withSpring(withProcessTranslation(nextPage), onScrollEnd);
}

This code demonstrates that if the minScrollDistancePerSwipeIsSet is true and the absolute value of totalTranslation is less than minScrollDistancePerSwipe, it calculates the next page based on the minScrollDistancePerSwipe and updates the translation.value accordingly, using a spring animation to keep the view at its current position.

The minScrollDistancePerSwipe property was introduced in the 4.0.0-alpha.10 release as indicated by the patch note:

  • #560 c181174 Thanks @dohooo! - Add a new props minScrollDistancePerSwipe to set the minimum scroll instance to make carousel scroll.

There is no mention of the removal or alteration of the minScrollDistancePerSwipe property in subsequent updates within the provided context.

If you're still having trouble accessing this property, could you please provide more information about the issue? For example, are you receiving any error messages? What steps are you taking to access this property? This will help me better understand the problem and provide a more accurate solution.

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.

@Crewiz
Copy link

Crewiz commented Jun 4, 2024

I hade version 3.12 so i updated to 3.5.1 and i am still getting this message

Type '{ ref: MutableRefObject<any>; loop: true; width: number; height: number; data: Channel[]; minScrollDistancePerSwipe: number; scrollAnimationDuration: number; onSnapToItem: (index: number) => void; onProgressChange: (offsetProgress: number, absoluteProgress: number) => void; renderItem: ({ item, index }: CarouselRend...' is not assignable to type 'IntrinsicAttributes & PropsWithChildren<TCarouselProps<Channel>>'.
  Property 'minScrollDistancePerSwipe' does not exist on type 'IntrinsicAttributes & PropsWithChildren<TCarouselProps<Channel>>'. Did you mean 'maxScrollDistancePerSwipe'?ts(2322)

using maxScrollDistancePerSwipe={300} does not cause any error whatsoever, it's just the minScrollDistancePerSwipe that is causing this error. I have tried deleteing node modules and running npm i but that did not change anything

Tried installing a working version with npm install git+https://github.com/dohooo/react-native-reanimated-carousel.git#v4.0.0-alpha.10

It removed the error but caused other errors, so now i am back to 3.5.1 and wit hno minscrolldistanceperswipe

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