[英]Unhandled JS Exception: undefined is not an object(evaluating 'global.performance.now') is in react-native-tvOS
I'm creating a React-Native-tvOs app and while running that default template app it shows this error.我正在创建一个 React-Native-tvOs 应用程序,并且在运行该默认模板应用程序时显示此错误。 I followed all the script from react-native-tvOs GitHub page but still, when I tried running it on the Xcode Apple TV simulator, it always throws this error.
我遵循了 react-native-tvOs GitHub 页面中的所有脚本,但是,当我尝试在 Xcode Apple TV 模拟器上运行它时,它总是会抛出此错误。
This is the script I'm running is from GitHub react-native-tvOS page:-这是我正在运行的脚本来自 GitHub react-native-tvOS页面:-
npm install -g @react-native-community/cli
react-native init FinalPOC --template=react-native-tvos@latest
cd FinalPOC && react-native run-ios --simulator "Apple TV" --scheme "FinalPOC-tvOS"
same error,同样的错误,
Modify this file react-native/Libraries/Utilities/createPerformanceLogger.js
maybe work.修改这个文件
react-native/Libraries/Utilities/createPerformanceLogger.js
可能react-native/Libraries/Utilities/createPerformanceLogger.js
。
modify调整
export const getCurrentTimestamp: () => number =
global.nativeQPLTimestamp ?? global.performance.now.bind(global.performance);
to到
export const getCurrentTimestamp: () => number = Date.now
I got the same error,我得到了同样的错误,
Remove node_modules with rm -rf rm -rf node_modules
使用 rm -rf
rm -rf node_modules
Then do npm install
然后执行
npm install
It works for me这个对我有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.