You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-9Lines changed: 38 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,10 +12,18 @@ Low overhead monitoring of important performance metrics for React Native apps l
12
12
bun add react-native-performance-toolkit react-native-nitro-modules
13
13
```
14
14
15
+
### Optional: Reanimated support
16
+
17
+
If you want to use UI thread components and hooks (recommended for accurate FPS display), install the optional dependencies:
18
+
19
+
```bash
20
+
bun add react-native-reanimated react-native-worklets react-native-gesture-handler
21
+
```
22
+
15
23
## Requirements
16
24
17
25
- React Native v0.76.0 or higher
18
-
- Reanimated v4 or higher
26
+
-(Optional) Reanimated v4 or higher - for UI thread components and hooks
19
27
20
28
## Usage
21
29
@@ -67,11 +75,13 @@ const SomeComponent = () => {
67
75
68
76
### Reanimated Hooks - UI Thread
69
77
78
+
> **Note:** These features require `react-native-reanimated` and `react-native-worklets` to be installed. Import from `react-native-performance-toolkit/reanimated`.
79
+
70
80
To avoid the issue with not showing 0 FPS, it's recommended to use Reanimated based hooks or pre-made components. This will ensure the value is updated even if the JS thread is blocked.
> **Note:** These features require `react-native-reanimated`, `react-native-worklets`, and `react-native-gesture-handler` to be installed. Import from `react-native-performance-toolkit/reanimated`.
111
+
100
112
For better DX, the library provides pre-made Reanimated components that run solely on the UI thread. You can use either the convenience wrappers or the flexible base component:
> **Note:** This requires `react-native-reanimated` and `react-native-worklets` to be installed.
173
+
160
174
You can also access the value from any worklet thread, but to do that you need to use [Nitro Modules unboxing function](https://nitro.margelo.com/docs/worklets). For more detailed implementation look for [source code of UI Reanimated hooks like `useFpsJsSharedValue`](https://github.com/Nodonisko/react-native-performance-toolkit/blob/main/src/hooks/uiThreadHooks.ts).
0 commit comments