类型错误:无法读取 null 的属性“__reanimatedWorkletInit”

时间:2021-03-24 19:36:57

标签: animation

反应原生; sdk40; 错误:React Native Gesture Handler 控制台上的错误消息:TypeError:无法读取 null 的属性 '__reanimatedWorkletInit'

部分代码出错:

// Animation
  const a1X = useSharedValue(0);
  const a1Y = useSharedValue(0);
  const onA1Move = useAnimatedGestureHandler({
    onStart:(event,ctx)=>{ // <<-- the error point stops here, at ":", im using .js
      ctx.a1X = a1X.value;
      ctx.a1Y = a1Y.value;
    },
    onActive:(event,ctx)=>{
      a1X.value = ctx.a1X + event.translationX;
      a1Y.value = ctx.a1Y + event.translationY;
    },
    onEnd:()=>{
      a1X.value = withSpring(0);
      a1Y.value = withSpring(0);
    }
  });
  const a1StyleTo = useAnimatedStyle(()=>{
    return{
      transform:[
        {translateX:a1X.value},
        {translateY:a1Y.value},
      ]
    }
  });

任何有经验的程序员的帮助?

0 个答案:

没有答案