Open 034502219988 opened 3 years ago
I am really short on time nowadays and I won't be able to add reanimated 2 support. Feel free to submit a PR and I will be more than happy to merge and release new version.
Same issue
I fix this issue just by changing the Easing to EasingNode in reanimatedHelpers.tsx
.
This is the code after i changed it
import Animated, { EasingNode } from 'react-native-reanimated';
const {
Value,
set,
cond,
startClock,
clockRunning,
timing,
stopClock,
block,
} = Animated;
export function runTiming(
clock: Animated.Clock,
value: Animated.Value<number>,
dest: Animated.Value<number>,
duration: number = 250,
easing: Animated.EasingNodeFunction = EasingNode.out(EasingNode.ease)
) {
const state = {
finished: new Value(0),
position: value,
time: new Value(0),
frameTime: new Value(0),
};
const config = {
duration,
toValue: dest,
easing,
};
return block([
cond(clockRunning(clock), 0, [
// If the clock isn't running we reset all the animation params and start the clock
set(state.finished, 0),
set(state.time, 0),
set(state.position, value),
set(state.frameTime, 0),
set(config.toValue, dest),
startClock(clock),
]),
// we run the step here that is going to update position
timing(clock, state, config),
// if the animation is over we stop the clock
cond(state.finished, stopClock(clock)),
// return the updated position
state.position,
]);
}
I have never contributed to any open source project before. I just changed the file inside the node_modules folder. I'm sure that's not safe. Perhaps someone can guide me to contribute to this project. Also, I don't know if the code above is the right answer or not.
I ran into the same issue and applied the above using patch-package
, which appears to have resolved this (for now at least). Thanks!
Easing was renamed to EasingNode in Reanimated 2. Please use EasingNode instead .