-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
136 lines (118 loc) · 3.21 KB
/
App.tsx
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import React, { useEffect, useState } from "react";
import {
Text,
Link,
HStack,
Center,
Heading,
Switch,
useColorMode,
NativeBaseProvider,
extendTheme,
VStack,
Code,
Container,
Stack,
StatusBar,
Box,
Icon,
IconButton
} from "native-base";
import NativeBaseIcon from "./components/NativeBaseIcon";
import * as Font from 'expo-font';
import { Ionicons } from '@expo/vector-icons';
import { MaterialIcons } from '@expo/vector-icons';
import TodoList from "./TodoList";
import AddTodo from "./AddTodo";
import {SafeAreaProvider} from 'react-native-safe-area-context'
//import { AppBar } from "react-native"
// Define the config
const config = {
useSystemColorMode: false,
initialColorMode: "dark",
};
// extend the theme
export const theme = extendTheme({ config });
function AppBar() {
return (
<>
<StatusBar backgroundColor="#3700B3" barStyle="light-content" />
<Box safeAreaTop backgroundColor="#6200ee" />
<HStack bg='#6200ee' px="1" py="3" justifyContent='space-between' alignItems='center'>
<HStack space="4" alignItems='center'>
<IconButton icon={<Icon size="sm" as={<MaterialIcons name='menu' />} color="white" />} />
<Text color="white" fontSize="20" fontWeight='bold'>TODO LIST</Text>
</HStack>
<HStack space="2">
<IconButton icon={<Icon as={<MaterialIcons name='favorite' />} size='sm' color="white" />} />
<IconButton icon={<Icon as={<MaterialIcons name='search' />}
color="white" size='sm' />} />
<IconButton icon={<Icon as={<MaterialIcons name='more-vert' />} size='sm' color="white" />} />
</HStack>
</HStack>
</>
)
}
export default function App() {
// const [isReady,setIsReady] = useState(false);
// useEffect(()=>{
// (
// async()=>{
// await Font.loadAsync({
// Roboto: require('native-base/Fonts/Roboto.ttf'),
// Roboto_medium: require('native-base/Fonts/Roboto_medium.ttf'),
// ...Ionicons.font,
// });
// setIsReady(true);
// }
// )();
// },[]);
// if(!isReady) {
// return (
// <Text>Loading.....</Text>
// )
// }
const [todoList, setTodoList] = useState([
{
id: 1,
title: "First Todo",
isCompleted: false
},
{
id: 2,
title: "Second Todo",
isCompleted: true
},
{
id: 3,
title: "Third Todo",
isCompleted: false
},
])
return (
<NativeBaseProvider >
<AppBar />
<Center flex={1} px="3" >
<AddTodo todoList={todoList} setTodoList = {setTodoList} />
<TodoList todoList={todoList} setTodoList = {setTodoList} />
</Center>
</NativeBaseProvider>
);
}
// Color Switch Component
// function ToggleDarkMode() {
// const { colorMode, toggleColorMode } = useColorMode();
// return (
// <HStack space={2} alignItems="center">
// <Text>Dark</Text>
// <Switch
// isChecked={colorMode === "light" ? true : false}
// onToggle={toggleColorMode}
// aria-label={
// colorMode === "light" ? "switch to dark mode" : "switch to light mode"
// }
// />
// <Text>Light</Text>
// </HStack>
// );
// }