Skip to content

Commit

Permalink
Fix 2048 example (#6205)
Browse files Browse the repository at this point in the history
## Summary

2048 example was crashing on web because of a function being referenced
before being initialised.

## Test plan


![image](https://github.com/software-mansion/react-native-reanimated/assets/77503811/1b5ed7f8-1fe9-4d60-8442-b73b131f0bf8)
  • Loading branch information
szydlovsky committed Jul 3, 2024
1 parent 0ea1379 commit c416bf6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/common-app/src/examples/Game2048Example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ export default function Game2048Example() {
const [tiles, setTiles] = React.useState(makeInitialBoard);
const [gameOver, setGameOver] = React.useState(false);

const handleReset = React.useCallback(() => {
setTiles(makeInitialBoard());
setGameOver(false);
}, []);

const fling = Gesture.Pan()
.runOnJS(true)
.onEnd((e) => {
Expand All @@ -245,11 +250,6 @@ export default function Game2048Example() {
}
});

const handleReset = React.useCallback(() => {
setTiles(makeInitialBoard());
setGameOver(false);
}, []);

return (
<GestureHandlerRootView style={styles.container}>
<GestureDetector gesture={fling}>
Expand Down

0 comments on commit c416bf6

Please sign in to comment.