@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/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useArcadeBridge.ts +6 -2
package/package.json
CHANGED
|
@@ -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 (
|
|
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
|
-
[
|
|
188
|
+
[triggerPlay, submitScore, onScoreSubmitted, onError],
|
|
185
189
|
);
|
|
186
190
|
|
|
187
191
|
return { webviewRef, handleMessage, triggerPlay, lastResult, bridgeLoading };
|