@vyshnav18/react-native-fps-counter 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +101 -0
  2. package/android/.gradle/9.2.0/checksums/checksums.lock +0 -0
  3. package/android/.gradle/9.2.0/checksums/md5-checksums.bin +0 -0
  4. package/android/.gradle/9.2.0/checksums/sha1-checksums.bin +0 -0
  5. package/android/.gradle/9.2.0/fileChanges/last-build.bin +0 -0
  6. package/android/.gradle/9.2.0/fileHashes/fileHashes.bin +0 -0
  7. package/android/.gradle/9.2.0/fileHashes/fileHashes.lock +0 -0
  8. package/android/.gradle/9.2.0/gc.properties +0 -0
  9. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  10. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  11. package/android/.gradle/vcs-1/gc.properties +0 -0
  12. package/android/build/reports/problems/problems-report.html +659 -0
  13. package/android/build.gradle +64 -0
  14. package/android/src/main/AndroidManifest.xml +3 -0
  15. package/android/src/main/java/com/rnfpscounter/FpsCounterModule.kt +120 -0
  16. package/android/src/main/java/com/rnfpscounter/FpsCounterPackage.kt +16 -0
  17. package/dist/index.d.mts +110 -0
  18. package/dist/index.d.ts +110 -0
  19. package/dist/index.js +192 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/index.mjs +188 -0
  22. package/dist/index.mjs.map +1 -0
  23. package/ios/FpsCounterModule.h +12 -0
  24. package/ios/FpsCounterModule.mm +123 -0
  25. package/ios/RNFpsCounter.podspec +21 -0
  26. package/package.json +73 -0
  27. package/react-native.config.js +14 -0
  28. package/src/FpsCounter.tsx +190 -0
  29. package/src/index.ts +10 -0
  30. package/src/specs/NativeFpsCounter.ts +26 -0
  31. package/src/useFPSMetric.ts +82 -0
  32. package/src/useUIFPSMetric.ts +81 -0
package/README.md ADDED
@@ -0,0 +1,101 @@
1
+ # react-native-fps-counter
2
+
3
+ A high-performance FPS counter for React Native that tracks both **JS thread** and **native UI thread** frame rates using Turbo Modules with JSI for minimal overhead.
4
+
5
+ ## Features
6
+
7
+ - 📊 **Dual-thread monitoring** - Track both JS and UI thread FPS
8
+ - âš¡ **Maximum performance** - Uses JSI/Turbo Modules for direct native calls
9
+ - 🔄 **Backward compatible** - Works with both new architecture (0.76+) and old bridge
10
+ - 📱 **Cross-platform** - iOS (CADisplayLink) and Android (Choreographer)
11
+ - 🎨 **Customizable** - Flexible styling and display options
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install react-native-fps-counter
17
+ # or
18
+ yarn add react-native-fps-counter
19
+ ```
20
+
21
+ ### iOS Setup
22
+
23
+ ```bash
24
+ cd ios && pod install
25
+ ```
26
+
27
+ ### Android
28
+
29
+ No additional setup required - auto-linking handles everything.
30
+
31
+ ## Usage
32
+
33
+ ### Basic Usage
34
+
35
+ ```tsx
36
+ import { View } from 'react-native';
37
+ import { FpsCounter } from 'react-native-fps-counter';
38
+
39
+ export default function App() {
40
+ return (
41
+ <View style={{ flex: 1 }}>
42
+ {/* Your app content */}
43
+ <FpsCounter />
44
+ </View>
45
+ );
46
+ }
47
+ ```
48
+
49
+ ### Component Props
50
+
51
+ | Prop | Type | Default | Description |
52
+ |------|------|---------|-------------|
53
+ | `visible` | `boolean` | `true` | Toggle visibility |
54
+ | `showJsFps` | `boolean` | `true` | Show JS thread FPS |
55
+ | `showUiFps` | `boolean` | `true` | Show UI thread FPS |
56
+ | `showAverage` | `boolean` | `true` | Show average values |
57
+ | `averageDecimalPlaces` | `number` | `1` | Decimal places for averages |
58
+ | `style` | `FpsCounterStyles` | - | Custom styling |
59
+
60
+ ### Using Hooks Directly
61
+
62
+ ```tsx
63
+ import { useFPSMetric, useUIFPSMetric } from 'react-native-fps-counter';
64
+
65
+ function MyComponent() {
66
+ // JS thread FPS (no native module required)
67
+ const { fps: jsFps, average: jsAverage } = useFPSMetric();
68
+
69
+ // Native UI thread FPS
70
+ const { uiFps, uiAverage } = useUIFPSMetric();
71
+
72
+ return (
73
+ <Text>
74
+ JS: {jsFps} | UI: {uiFps}
75
+ </Text>
76
+ );
77
+ }
78
+ ```
79
+
80
+ ## How It Works
81
+
82
+ | Thread | Method | Description |
83
+ |--------|--------|-------------|
84
+ | **JS Thread** | `requestAnimationFrame` | Measures JavaScript execution loop |
85
+ | **UI Thread (iOS)** | `CADisplayLink` | Syncs with display refresh rate |
86
+ | **UI Thread (Android)** | `Choreographer` | Native frame callback system |
87
+
88
+ ## Architecture Support
89
+
90
+ - ✅ **New Architecture (0.76+)** - Uses Turbo Modules with JSI
91
+ - ✅ **Old Architecture** - Falls back to bridge (same API)
92
+
93
+ ## Tips
94
+
95
+ 1. **Place at root level** - Put `<FpsCounter>` at the root of your app for accurate measurements
96
+ 2. **Release builds** - This works in release builds where dev tools aren't available
97
+ 3. **Minimal impact** - The native modules have negligible performance overhead
98
+
99
+ ## License
100
+
101
+ MIT
File without changes
@@ -0,0 +1,2 @@
1
+ #Sun Feb 01 14:07:00 IST 2026
2
+ gradle.version=9.2.0
File without changes