'TypeError: global.performance.now is not a function in react native

error


Unable to find any solution to this query.

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




Solution 1:[1]

make change to this file: node_modules/react-native-reanimated/src/reanimated2/core.ts Line 386, remove this:

global.performance = {
 now: global._chronoNow,

};

then add this:

if(global.performance == null) {
    global.performance = {
      now: global._chronoNow,
    };
  }

Solution 2:[2]

This is reanimated issue, fix will be released soon https://github.com/software-mansion/react-native-reanimated/commit/aef72c0875b559eecb7e10abaf00e49186d7ae55, for now, I would advise downgrading it to 2.2.4

Solution 3:[3]

If you are using the expo application, then try reinstalling the latest expo application or connect the device to the computer and run the expo start command, then hit (a or i) to automatically install the compatible version on your devices.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 devbiswasnegi
Solution 2 Amit Dutta
Solution 3 Pratik Khadka