react-native-earl-gamepad 0.7.0 → 0.7.1
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.
- package/README.md +16 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -151,6 +151,15 @@ export function DebugScreen() {
|
|
|
151
151
|

|
|
152
152
|

|
|
153
153
|
|
|
154
|
+
## Demo
|
|
155
|
+
|
|
156
|
+
https://github.com/user-attachments/assets/6b073b65-9585-4168-8c2c-7ef06a7cf03a
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
https://github.com/user-attachments/assets/b5a9d422-b143-4887-9a64-fb41edee731f
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
154
163
|
## API
|
|
155
164
|
|
|
156
165
|
### `GamepadBridge` props
|
|
@@ -208,6 +217,13 @@ Button names map to the standard gamepad layout (`a`, `b`, `x`, `y`, `lb`, `rb`,
|
|
|
208
217
|
- Axis values below the deadzone are coerced to `0`. Adjust `axisThreshold` if you need more sensitivity.
|
|
209
218
|
- LT/RT expose analog values via `buttonValues.lt` and `buttonValues.rt`.
|
|
210
219
|
|
|
220
|
+
## Performance tips
|
|
221
|
+
|
|
222
|
+
- For movement/game loops in your app, prefer `requestAnimationFrame` over `setInterval` to avoid jitter from timer drift.
|
|
223
|
+
- Skip game loop work when no controller is connected (use `onStatus` or the hook’s `info.connected`).
|
|
224
|
+
- If you need to lower CPU/GPU cost, you can poll at a fixed interval inside your app logic (e.g., 45–60 fps) while the bridge keeps its internal rAF poll for accurate state.
|
|
225
|
+
- Avoid remounting the bridge; mount once near the root and let `enabled` toggle collection if you must pause.
|
|
226
|
+
|
|
211
227
|
## Patterns
|
|
212
228
|
|
|
213
229
|
- **Single place to render**: put the bridge near the root (e.g., inside your `App` provider layer) and consume state anywhere via `useGamepad`.
|