I am trying to measure how long does it take for images to load in a react native app on my users' devices in different countries.
In debug mode there is performance.now() that creates timestamp that I then send as a property of the event to Amplitude.
But performance.now() is a JS method and is not available in Release builds for users. There is an undocumented global.nativePerformanceNow method
const loadStartAmplitudeEvent = () => {
if (R.not(__DEV__)) {
const timeStamp = global.nativePerformanceNow();
amplitude.logEvent('Photo On Load Start', {
uri, timeStamp,
});
}
};
For example, that's how I create an event with a timestamp to send to amplitude, but I get an error, what am I doing wrong? Thanks a lot! Should i use some other method? Is the global.nativePerformanceNow → g.nativePerformanceNow transformation messing it up?
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)