reanimated-collapsible-helpers icon indicating copy to clipboard operation
reanimated-collapsible-helpers copied to clipboard

Easing was renamed to EasingNode in Reanimated 2. Please use EasingNode instead

Open 034502219988 opened this issue 3 years ago • 4 comments

Easing was renamed to EasingNode in Reanimated 2. Please use EasingNode instead . Screen Shot 2021-05-17 at 11 10 35 AM

034502219988 avatar May 17 '21 06:05 034502219988

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.

Trancever avatar Jun 08 '21 07:06 Trancever

Same issue

tiamed avatar Apr 11 '22 03:04 tiamed

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.

galih56 avatar Apr 18 '22 03:04 galih56

I ran into the same issue and applied the above using patch-package, which appears to have resolved this (for now at least). Thanks!

GideonCaspi avatar May 19 '22 16:05 GideonCaspi