react-native-performance is a library that brings a comprehensive implementation of the Web Performance API (User Timing Level 3 and Performance Timeline Level 2) to React Native applications. It provides high-resolution, monotonically increasing timestamps for accurate measurement, independent of system clock adjustments. The current stable version is 6.0.0, released in late 2024. The project maintains an active release cadence with frequent patch and minor updates, and major versions introducing breaking changes every few months. Key differentiators include its adherence to web standards, support for custom metrics, optional network resource logging (for fetch/XMLHttpRequest), and native marks for measuring core application startup and lifecycle events. It also offers the PerformanceObserver API for subscribing to performance entries and ships with full TypeScript type definitions.
npm install react-native-performanceVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates marking, measuring, custom metrics, network resource logging, and observing performance entries using `PerformanceObserver` with detailed metadata.
Review your native module integration and update to the new API methods and codegen setup. Remove any Flipper-related performance code.
No direct code fix needed for consumers, but be aware that native startup time metrics might reflect different values compared to previous versions due to the improved measurement accuracy.
Ensure your React Native version is 0.68.3 or newer when upgrading to react-native-performance v4.0.0+. Older versions might not be compatible.
Use `const unixTimestamp = Date.now() - performance.timeOrigin + entry.startTime;` for accurate conversions.
Call `setResourceLoggingEnabled(true);` early in your application's lifecycle to activate resource logging.
Upgrade to `react-native-performance` version 6.0.0 or later, which includes a fix for this specific Android issue.
Upgrade to `react-native-performance` version 5.1.4 or later, which contains fixes for bridgeless mode on both iOS and Android.
Upgrade to `react-native-performance` version 5.1.3 or later, which addresses a build failure on iOS related to custom native marks.
Ensure you are using `import { PerformanceObserver } from 'react-native-performance';` and not a default import for `PerformanceObserver`.