0

我正在使用 react-native-reanimated,并且在使用此道具时我遇到了 iOS 崩溃Animated.useCode

我的道具主体的完整代码在这里:

  Animated.useCode(
() =>
  Animated.onChange(
    callbackNode.current,
    Animated.block([
      Animated.cond(
        Animated.greaterThan(callbackNode.current, 0),
        Animated.call([], () => {
          onCloseBottomSheet && onCloseBottomSheet();
        }),
      ),
      Animated.cond(
        Animated.eq(callbackNode.current, 0),
        Animated.call([], () => {
          onFullScreen && onFullScreen();
        }),
      ),
    ]),
  ),
[onCloseBottomSheet, onFullScreen],);

当评论这个道具时,应用程序返回工作并且崩溃消失

Xcode 的崩溃输出是:

Thread 1: "-[REASetNode beginContext:prevCallID:]: unrecognized selector sent to instance 0x6000014d0410".

任何机构都可以帮助我解决这个问题,或者如果之前有过这个问题。

4

1 回答 1

0

您是否将 babel 插件添加到您的babel.config.js. 更多信息在这里(https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation

必须在最后列出重新激活的插件。

  module.exports = {
      ...
      plugins: [
          ...
          'react-native-reanimated/plugin',
      ],
  };
于 2021-12-06T19:26:12.007 回答