类型错误:global.performance.now 不是 React Native 中的函数

Fas*_*med 9 reactjs react-native react-redux

错误


无法找到此查询的任何解决方案。

TypeError: global.performance.now is not a function
at node_modules/expo/build/logs/LogSerialization.js:156:14 in _captureConsoleStackTrace
at node_modules/expo/build/logs/LogSerialization.js:41:26 in serializeLogDataAsync
- ... 9 more stack frames from framework internals


Run Code Online (Sandbox Code Playgroud)

小智 26

更改此文件:node_modules/react-native-reanimated/src/reanimated2/core.ts 第 386 行,删除此:

global.performance = {
 now: global._chronoNow,
Run Code Online (Sandbox Code Playgroud)

};

然后添加:

if(global.performance == null) {
    global.performance = {
      now: global._chronoNow,
    };
  }
Run Code Online (Sandbox Code Playgroud)

  • 这是一个临时解决方案。请提供永久解决方案。因为每次安装节点模块后都会更改它。 (5认同)