@dubsdotapp/expo 0.4.0 → 0.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dubsdotapp/expo",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "React Native SDK for the Dubs betting platform",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -90,6 +90,10 @@ export function useArcadeBridge({
90
90
  const sessionTokenRef = useRef<string | null>(null);
91
91
  const gameStartTimeRef = useRef<number>(0);
92
92
 
93
+ // Keep canPlay in a ref so TAP_PLAY handler always sees the latest value
94
+ const canPlayRef = useRef(canPlay);
95
+ canPlayRef.current = canPlay;
96
+
93
97
  const [lastResult, setLastResult] = useState<SubmitScoreResult | null>(null);
94
98
  const [bridgeLoading, setBridgeLoading] = useState(false);
95
99
 
@@ -139,7 +143,7 @@ export function useArcadeBridge({
139
143
 
140
144
  switch (data.type) {
141
145
  case 'TAP_PLAY': {
142
- if (canPlay) {
146
+ if (canPlayRef.current) {
143
147
  triggerPlay();
144
148
  }
145
149
  return;
@@ -181,7 +185,7 @@ export function useArcadeBridge({
181
185
  return;
182
186
  }
183
187
  },
184
- [canPlay, triggerPlay, submitScore, onScoreSubmitted, onError],
188
+ [triggerPlay, submitScore, onScoreSubmitted, onError],
185
189
  );
186
190
 
187
191
  return { webviewRef, handleMessage, triggerPlay, lastResult, bridgeLoading };