如何在react native production build中访问global.nativePerformanceNow()?或任何其他测量时间戳的方法

如何在react native production build中访问global.nativePerformanceNow()?或任何其他测量时间戳的方法,performance,react-native,timestamp,Performance,React Native,Timestamp,我正在尝试测量在不同国家/地区的用户设备上,图像加载到react本机应用程序需要多长时间 在调试模式下,performance.now()将创建时间戳,然后将该时间戳作为事件的属性发送给Amplication 但是performance.now()是一个JS方法,在用户的发布版本中不可用。存在未记录的global.nativePerformanceNow方法 const loadStartAmplitudeEvent=()=>{ 如果(R.not(_DEV__)){ const timeStam

我正在尝试测量在不同国家/地区的用户设备上,图像加载到react本机应用程序需要多长时间

在调试模式下,performance.now()将创建时间戳,然后将该时间戳作为事件的属性发送给Amplication

但是performance.now()是一个JS方法,在用户的发布版本中不可用。存在未记录的global.nativePerformanceNow方法

const loadStartAmplitudeEvent=()=>{
如果(R.not(_DEV__)){
const timeStamp=global.nativePerformanceNow();
振幅.logEvent(‘负载启动时的照片’{
uri,时间戳,
});
}
};
例如,这就是我如何创建一个带有时间戳的事件来发送到振幅,但我得到一个错误,我做错了什么?谢谢!我应该用别的方法吗?全球、本地性能是否正常→ g、 国家绩效——新的转型会把事情搞砸吗

2019-08-06 03:10:45.134 [error][tid:com.facebook.react.JavaScript]
g.nativePerformanceNow is not a function. 
(In 'g.nativePerformanceNow()', 'g.nativePerformanceNow' is undefined)

似乎该功能已于2018年10月中旬从RN中删除

这会在设备上崩溃(在Chrome工具上工作,有点meh):

但也似乎是最近死而复生的。 所以下一个React本机版本可能包括performance、performanceNow()、performance.now()