Skip to content

Commit

Permalink
playground header
Browse files Browse the repository at this point in the history
  • Loading branch information
asantaelly committed Sep 27, 2023
1 parent 0d1af82 commit 3909b90
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 19 deletions.
5 changes: 4 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
"**/*"
],
"ios": {
"supportsTablet": true
"supportsTablet": true,
"config": {
"usesNonExemptEncryption": false
}
},
"android": {
"adaptiveIcon": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@react-navigation/native": "^6.1.8",
"@react-navigation/native-stack": "^6.9.14",
"expo": "~49.0.11",
"expo-secure-store": "~12.3.1",
"expo-status-bar": "~1.6.0",
"lodash": "^4.17.21",
"react": "18.2.0",
Expand All @@ -28,4 +29,4 @@
"typescript": "^5.1.3"
},
"private": true
}
}
13 changes: 1 addition & 12 deletions src/Providers/Level.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React from "react";
import * as SecureStore from "expo-secure-store";

type ComponentProps = {
children: React.ReactNode;
};

type LevelProps = {
loser: boolean;
highScore: number;
tapCounter: number;
// getHighScore: () => void;
setLoser: React.Dispatch<React.SetStateAction<boolean>>;
setTapCounter: React.Dispatch<React.SetStateAction<number>>;
};
Expand All @@ -21,24 +20,14 @@ const LevelProvider: React.FC<ComponentProps> = (props) => {
/** Context states */
const [loser, setLoser] = React.useState<boolean>(false);
const [tapCounter, setTapCounter] = React.useState<number>(0);
const [highScore, setHighScore] = React.useState<number>(0);

/** a function to calculate high score */
// const getHighScore = () => {
// if (tapCounter > highScore) {
// setHighScore(tapCounter);
// }
// return;
// };

return (
<LevelContext.Provider
value={{
loser,
setLoser,
highScore,
tapCounter,
// getHighScore,
setTapCounter,
}}
>
Expand Down
3 changes: 1 addition & 2 deletions src/components/screens/Auditorium/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { StyleSheet, Text, View } from "react-native";
import { useNavigation } from "@react-navigation/native";
import { SafeAreaView } from "react-native-safe-area-context";

import PressableIcon from "../../libs/icons/PressableIcon";
Expand All @@ -20,7 +19,7 @@ const Header: React.FC<Props> = (props) => {
<SafeAreaView style={[styles.container]} edges={["top", "left", "right"]}>
<View style={[styles.header, styles.shadow]}>
<View style={[styles.scoreBoard]}>
<Text style={[{ fontWeight: "600" }]}>Champion: 12000</Text>
<Text style={[{ fontWeight: "600" }]}>Champion: 223212</Text>
<Text style={[{ fontWeight: "600" }]}>Points: {point}</Text>
</View>
<View style={[styles.avatarCircular]}>
Expand Down
1 change: 1 addition & 0 deletions src/components/shared/Tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ const Tile: React.FC<Props> = (props) => {
play();
}, []);

/** check for loser */
React.useEffect(() => {
if (loser) {
cancelAnimation(translateY1);
Expand Down
5 changes: 5 additions & 0 deletions src/navigation/AppNavigator.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import React from "react";
import * as SecureStore from "expo-secure-store";

import MainStack from "./routes/Main";
import { LevelContext } from "../providers/Level";

const AppNavigator = () => {

return <MainStack />;
};

Expand Down
4 changes: 3 additions & 1 deletion src/navigation/routes/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const AppStack = createNativeStackNavigator<MainStackProps>();

const MainStack = () => {
return (
<AppStack.Navigator initialRouteName="Welcome">
<AppStack.Navigator initialRouteName="Welcome" screenOptions={{
headerShown: true
}}>
<AppStack.Screen
name="Welcome"
component={Welcome}
Expand Down
5 changes: 3 additions & 2 deletions src/screens/playground/Auditorium.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const Auditorium = () => {
setViewHeight(height);
};

/** count down */
React.useEffect(() => {
if (countDown === 0) return;

Expand All @@ -48,9 +49,9 @@ const Auditorium = () => {
<View style={[styles.container]}>
{loser && <LoserModal />}
{countDown !== 0 ? (
// <View style={[styles.countDownContainer]}>
<View style={[styles.countDownContainer]}>
<Text style={[styles.extraLargeText]}>{countDown}</Text>
// {/* </View> */}
</View>
) : (
<React.Fragment>
{tiles.map((tile, key) => (
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3280,6 +3280,11 @@ expo-modules-core@1.5.11:
compare-versions "^3.4.0"
invariant "^2.2.4"

expo-secure-store@~12.3.1:
version "12.3.1"
resolved "https://registry.yarnpkg.com/expo-secure-store/-/expo-secure-store-12.3.1.tgz#7e5ba94f6e7374f132108c9feb5cc811568f3db6"
integrity sha512-XLIgWDiIuiR0c+AA4NCWWibAMHCZUyRcy+lQBU49U6rvG+xmd3YrBJfQjfqAPyLroEqnLPGTWUX57GyRsfDOQw==

expo-status-bar@~1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/expo-status-bar/-/expo-status-bar-1.6.0.tgz#e79ffdb9a84d2e0ec9a0dc7392d9ab364fefa9cf"
Expand Down

0 comments on commit 3909b90

Please sign in to comment.