-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
71 lines (65 loc) · 2.3 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import * as React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import {StartScreen} from './Pages/StartScreen';
import {GameScreen} from './Pages/GameScreen';
import { AdminScreen } from './Pages/AdminScreen';
import { DeviceEventEmitter } from "react-native";
import { ScoreUploadScreen } from "./Pages/ScoreUploadScreen";
import { AppRegistry } from 'react-native';
import { PaperProvider } from 'react-native-paper';
import {Button} from 'react-native-paper';
import { useTheme } from 'react-native-paper';
const Stack = createNativeStackNavigator();
export const scoreContext = React.createContext(
0
);
export default function App() {
const theme = useTheme();
let [currentScore, setCurrentScore] = React.useState(0);
function setScore(score) {
setCurrentScore(score);
}
DeviceEventEmitter.addListener("event.scored", (eventData) => {
setCurrentScore(currentScore + 1);
// setff(ff+1);
console.log("Score:", currentScore);
});
return (
<scoreContext.Provider value={[currentScore,setCurrentScore]}>
<PaperProvider>
<NavigationContainer>
<Stack.Navigator initialRouteName='StartScreen'>
<Stack.Screen name='StartScreen'
options={{ title: 'START',
headerStyle:{
backgroundColor: ""
},
headerTitleAlign: "center",
headerTitleStyle:{
fontSize: 15,
fontWeight: "bold",
color: "black"
}
}}
component={StartScreen} />
<Stack.Screen
name="GameScreen"
component={GameScreen}
/>
<Stack.Screen
name="AdminScreen"
component={AdminScreen}
/>
<Stack.Screen
name="ScoreUploadScreen"
component={ScoreUploadScreen}
/>
{/* options={{ title: "Home | MobileAnt App", headerBackVisible: false }} */}
</Stack.Navigator>
</NavigationContainer>
</PaperProvider>
</scoreContext.Provider>
);
}
AppRegistry.registerComponent("uwu", () => Main);