-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
37 lines (29 loc) · 901 Bytes
/
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
import React, { useState } from 'react'
import { StyleSheet, View } from 'react-native'
import Header from './components/Header'
import StartScreen from './components/screens/StartScreen'
import TarckingScreen from './components/screens/TrackingScreen'
import colors from './constants/colors'
export default function App() {
const [screen, setScreen] = useState('start')
const onStartTracking = () => setScreen('tracking')
const onStopTracking = () => setScreen('start')
const display = {
start: <StartScreen onPressButton={onStartTracking} />,
tracking: <TarckingScreen onPressButton={onStopTracking} />,
}
return (
<View style={styles.screen}>
<Header />
{display[screen]}
</View>
)
}
const styles = StyleSheet.create({
screen: {
flex: 1,
backgroundColor: colors.background,
alignItems: 'center',
justifyContent: 'center',
},
})