Skip to content

Commit

Permalink
fix: added some time to read the content in the second card and fixed…
Browse files Browse the repository at this point in the history
… naming and description
  • Loading branch information
a-fortunato committed May 9, 2021
1 parent f2e3c63 commit bbcbb64
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"expo": {
"name": "memory-game",
"name": "Memory Game",
"slug": "memory-game",
"version": "1.0.0",
"description": "Very basic approach to the classic Concentration / Memory cards game.",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Memory Game",
"name": "memory-game",
"author": "Anggella Fortunato",
"repository": "https://github.com/a-fortunato/memory-game",
"main": "node_modules/expo/AppEntry.js",
Expand Down
3 changes: 2 additions & 1 deletion src/components/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ function Card(props: PropsWithChildren<CardProps>): React.ReactElement | null {
const [isFlipped, setFlipped] = useState<boolean>(false)

useEffect(() => {
// flip the card back after a bit to give the player enough time to see the content
setTimeout(() => {
if (flippedCards.includes(id) && !isFlipped) {
setFlipped(true)
} else if (!flippedCards.includes(id) && isFlipped) {
setFlipped(false)
}
}, 0)
}, 350)
}, [id, flippedCards, isFlipped])

if (showEmpty) {
Expand Down

0 comments on commit bbcbb64

Please sign in to comment.