-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
66 lines (60 loc) · 1.59 KB
/
App.tsx
File metadata and controls
66 lines (60 loc) · 1.59 KB
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
import { StatusBar } from "expo-status-bar";
import { StyleSheet, View } from "react-native";
import HealthData from "./components/HealthData";
import RingProgress from "./components/RingProgress";
import useHealthData from "./hooks/useHealthData";
import { useState } from "react";
import DatePicker from "./components/DatePicker";
const STEPS_GOAL = 10000;
export default function App() {
const [date, setDate] = useState(new Date());
const { steps, distance, flights } = useHealthData(date);
return (
<View style={styles.container}>
<DatePicker date={date} setDate={setDate} />
<RingProgress progress={steps / STEPS_GOAL} />
<View style={styles.dataContainer}>
<HealthData label="Steps" value={steps.toFixed(0)} />
<HealthData
label="Distance"
value={`${(distance / 1000).toFixed(2)} km`}
/>
<HealthData label="Flights Climbed" value={flights.toString()} />
</View>
<StatusBar style="light" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "black",
justifyContent: "center",
padding: 12,
},
dataContainer: {
gap: 55,
flexDirection: "row",
flexWrap: "wrap",
marginVertical: 20,
},
datePicker: {
alignItems: "center",
padding: 20,
flexDirection: "row",
justifyContent: "center",
},
date: {
color: "white",
fontWeight: "500",
fontSize: 20,
marginHorizontal: 20,
},
datePickerButton: {
display: "flex",
justifyContent: "center",
alignItems: "center",
height: 40,
width: 40,
},
});