-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
49 lines (44 loc) · 1.57 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
import React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import Home from './src/screens/Home';
import DiaryDetail from './src/screens/DiaryDetail';
import DiaryRecord from './src/screens/DiaryRecord';
import DiaryEdit from './src/screens/DiaryEdit';
import {config, GluestackUIProvider} from '@gluestack-ui/themed';
import {Database} from '@nozbe/watermelondb';
import SQLiteAdapter from '@nozbe/watermelondb/adapters/sqlite';
import {DatabaseProvider} from '@nozbe/watermelondb/DatabaseProvider';
import schema from './src/model/schema';
import Diary from './src/model/Diary';
import Sentiment from './src/model/Sentiment';
const adapter = new SQLiteAdapter({
schema,
dbName: 'commenta',
jsi: true,
onSetUpError(error) {
console.error(error);
},
});
const database = new Database({
adapter,
modelClasses: [Diary, Sentiment],
});
const Stack = createStackNavigator();
const App = () => {
return (
<GluestackUIProvider config={config.theme}>
<DatabaseProvider database={database}>
<NavigationContainer>
<Stack.Navigator initialRouteName="Home">
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="DiaryDetail" component={DiaryDetail} />
<Stack.Screen name="DiaryRecord" component={DiaryRecord} />
<Stack.Screen name="DiaryEdit" component={DiaryEdit} />
</Stack.Navigator>
</NavigationContainer>
</DatabaseProvider>
</GluestackUIProvider>
);
};
export default App;