Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
react-native-performance-stats
Advanced tools
Get performance metrics like UI Thread FPS, JS Thread FPS, App memory and CPU (just like the "Perf Monitor").
import PerformanceStats from "react-native-performance-stats";
useEffect(() => {
const listener = PerformanceStats.addListener((stats) => {
console.log(stats);
});
// you must call .start(true) to get CPU as well
PerformanceStats.start();
// ... at some later point you could call:
// PerformanceStats.stop();
return () => listener.remove();
}, []);
✅ Compatible with the new architecture (and backwards compatible with "old arch")
yarn add react-native-performance-stats
npm i react-native-performance-stats
Run pod install:
npx pod-install
No additional steps for android are required, except when using the new react native architecture:
(Note: This setup is required to to the fact that the on android Autolinking doesn't work with the new architecture out of the box. This procedure will change in the future.)
android/app/build.gradle
file and update the file as it follows:
defaultConfig {
...
"PROJECT_BUILD_DIR=$buildDir",
"REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
- "REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build"
+ "REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
+ "NODE_MODULES_DIR=$rootDir/../node_modules/"
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
cppFlags "-std=c++17"
android/app/src/main/jni/Android.mk
file and update the file as it follows:
# If you wish to add a custom TurboModule or Fabric component in your app you
# will have to include the following autogenerated makefile.
# include $(GENERATED_SRC_DIR)/codegen/jni/Android.mk
+
+ # Includes the MK file for `react-native-performance-stats`
+ include $(NODE_MODULES_DIR)/react-native-performance-stats/android/build/generated/source/codegen/jni/Android.mk
+
include $(CLEAR_VARS)
LOCAL_SHARED_LIBRARIES
setting and add the following line:
libreact_codegen_rncore \
+ libreact_codegen_performancestats \
libreact_debug \
android/app/src/main/jni/MainApplicationModuleProvider.cpp
file and update the file as it follows:
#include <answersolver.h>
+ #include <performancestats.h>
MainApplicationModuleProvider
constructor:
// auto module = samplelibrary_ModuleProvider(moduleName, params);
// if (module != nullptr) {
// return module;
// }
+ auto module = performancestats_ModuleProvider(moduleName, params);
+ if (module != nullptr) {
+ return module;
+ }
return rncore_ModuleProvider(moduleName, params);
}
true
to the .start
function to track CPU as well.react-native-performance-stats
may started tracking at another point in time than the "Perf Monitor", thus they refresh at different times.FAQs
Get FPS, memory and CPU usage of your React Native app
The npm package react-native-performance-stats receives a total of 502 weekly downloads. As such, react-native-performance-stats popularity was classified as not popular.
We found that react-native-performance-stats demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.