react-native-earl-gamepad 0.7.0 → 0.7.2

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 (2) hide show
  1. package/README.md +25 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -151,6 +151,24 @@ export function DebugScreen() {
151
151
  ![Gamepad visual pressed](https://github.com/user-attachments/assets/830323aa-0f6c-4ee4-a276-663a421b9697)
152
152
  ![Gamepad Idle](https://github.com/user-attachments/assets/206fe108-8ec3-40cb-a64b-de058d07672f)
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
+ ## Example
162
+ ### Basic Game Showcasing `react-native-earl-gamepad`
163
+ [Github Repository Basic Game](https://github.com/Swif7ify/react-native-earl-gamepad-example)
164
+ ```sh
165
+ # external repo
166
+ git clone https://github.com/Swif7ify/react-native-earl-gamepad-example
167
+ cd react-native-earl-gamepad-example
168
+ npm install
169
+ npx expo start
170
+ ```
171
+
154
172
  ## API
155
173
 
156
174
  ### `GamepadBridge` props
@@ -208,6 +226,13 @@ Button names map to the standard gamepad layout (`a`, `b`, `x`, `y`, `lb`, `rb`,
208
226
  - Axis values below the deadzone are coerced to `0`. Adjust `axisThreshold` if you need more sensitivity.
209
227
  - LT/RT expose analog values via `buttonValues.lt` and `buttonValues.rt`.
210
228
 
229
+ ## Performance tips
230
+
231
+ - For movement/game loops in your app, prefer `requestAnimationFrame` over `setInterval` to avoid jitter from timer drift.
232
+ - Skip game loop work when no controller is connected (use `onStatus` or the hook’s `info.connected`).
233
+ - 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.
234
+ - Avoid remounting the bridge; mount once near the root and let `enabled` toggle collection if you must pause.
235
+
211
236
  ## Patterns
212
237
 
213
238
  - **Single place to render**: put the bridge near the root (e.g., inside your `App` provider layer) and consume state anywhere via `useGamepad`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-earl-gamepad",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "React Native gamepad bridge via WebView (buttons, sticks, d-pad, status).",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",