【问题标题】:React-Native-Reanimated: error: node_modules\react-native-reanimated\src\index.ts:React-Native-Reanimated: 错误: node_modules\\react-native-reanimated\\src\\index.ts:
【发布时间】:2022-11-17 09:09:29
【问题描述】:

我正在制作新项目,但我无法运行带有此错误的 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';

我不确定该怎么做,请帮忙。先感谢您!

【问题讨论】:

    标签: android react-native node-modules react-native-reanimated


    【解决方案1】:

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

    访问这个 expo 恢复文档链接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'],
      };
    };
    

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

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

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

    【讨论】:

      【解决方案2】:

      我有同样的问题,这个版本适合我

          "react-native-reanimated": "2.9.1"
      

      【讨论】:

        猜你喜欢
        • 2021-12-12
        • 2022-01-26
        • 2022-10-14
        • 1970-01-01
        • 2020-10-12
        • 2021-12-08
        • 2022-01-11
        • 2022-01-09
        • 2021-11-08
        相关资源
        最近更新 更多