-
Notifications
You must be signed in to change notification settings - Fork 133
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
Transition of "type: decay" appears to be broken #321
Comments
Is it web only? Can you confirm it works with normal reanimated but just not moti? |
Bug initially popped up for me on ios, validated it with web playground. I'll whip up a test with vanilla reanimated in a moment to confirm 👍 |
Cool thanks |
Alright, reproduction for this actually needs to be hooked to gesture (that's how const pan = Gesture.Pan()
.onChange(({ translationY }) => {
translate.value = translationY;
})
.onFinalize(({ velocityY }) => {
translate.value = withDecay({
velocity: velocityY
});
}) But this (what I believe is equivalent with moti) throws an error when it hits animation with decay const pan = Gesture.Pan()
.onChange(({ translationY }) => {
animationState.animateTo({ translateY: translationY, transition: { type: 'no-animation' } })
})
.onFinalize(({ velocityY }) => {
animationState.animateTo({ translateY: 0, transition: { type: 'decay', velocity: velocityY } })
}) I might be missing out on some differences between decay and say spring animation api's within moti, in this case, perhaps an example with decay in the docs could be good? |
How does reanimated perform if you add these values: velocity: 2,
deceleration: 2, |
It seems to bug out / shoot everything off to the distance 😅 I copied and set up example from reanimated in this expo snack Set values back to normal, but you can set velocity and decay to 2 on line ~30 to see the effect |
Can you try |
I'm wondering if |
Getting same error on 0.26.1 as well (testing on ios with fresh node_modules install and ios project rebuild) |
How odd, and it works with plain reanimated? |
Yes, working example is in the snack I provided above by copying from reanimated's docs. (also tested locally on my own implementation). |
Is there an existing issue for this?
Do you want this issue prioritized?
Current Behavior
React native reanimated library exposes
withDecay
helper documented here https://docs.swmansion.com/react-native-reanimated/docs/animations/withDecay it appears from the source that moti also supports this by setting transition totype: 'decay'
however, doing so breaks the app. with following error:Expected Behavior
Should not break and allow to use decay animations.
Steps To Reproduce
Versions
Screenshots
Screen.Recording.2023-10-27.at.18.00.19.mov
Reproduction
https://stackblitz.com/edit/nextjs-9sshqj?file=pages%2Findex.tsx
The text was updated successfully, but these errors were encountered: