React-Native-Reanimated:错误:node_modules\react-native-reanimated\src\index.ts:

mar*_*ine 8 android node-modules react-native react-native-reanimated

我正在制作新项目,但无法运行 Android 模拟器并出现此错误。

在此输入图像描述

在此输入图像描述

它位于“node_modules\react-native-reanimated\src\index.ts”,这只是其中的代码:

// tree-shaken side effects
import './reanimated2/js-reanimated/global';

// @ts-ignore backward compatibility with treeshaking
export * from './reanimated1';
export * from './reanimated2';
export * as default from './Animated';
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

我不知道该怎么办,请帮忙。先感谢您!

mar*_*ine 10

我也在寻找答案,这对我有用。

访问此博览会重新启动的文档链接https://docs.expo.dev/versions/latest/sdk/reanimated/#installation

我将其添加到我的“babel.config.js”文件中

module.exports = function(api) {
  api.cache(true);
  return {
    presets: ['module:metro-react-native-babel-preset'],
    plugins: ['react-native-reanimated/plugin'],
  };
};
Run Code Online (Sandbox Code Playgroud)

我认为预设取决于您是否使用 expo。这是文档给出的原始代码:

module.exports = function(api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
    plugins: ['react-native-reanimated/plugin'],
  };
};
Run Code Online (Sandbox Code Playgroud)

你可以看到我使用了我的默认预设,即 module:metro。