Repository navigation
Expand file tree
/
Copy pathApp.js
More file actions
61 lines (54 loc) · 1.59 KB
/
Copy pathApp.js
File metadata and controls
61 lines (54 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
import React, { useState, useEffect } from 'react';
import { StyleSheet } from 'react-native';
import * as eva from '@eva-design/eva';
import { ApplicationProvider, Layout, Text } from '@ui-kitten/components';
import LoginScreen from "./screens/LoginScreen";
import { SafeAreaView } from 'react-native';
import HomeScreen from './screens/HomeScreen';
import { supabase } from './supabase';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import TipsScreen from './screens/TipsScreen';
import CalendarScreen from './screens/CalendarScreen';
const Stack = createStackNavigator();
export default () => {
const [session, setSession] = useState(null);
useEffect(() => {
supabase.auth.getSession().then(({ data: { session } }) => {
setSession(session)
})
supabase.auth.onAuthStateChange((_event, session) => {
setSession(session)
})
}, [])
return (
<>
<ApplicationProvider
{...eva}
theme={eva.light}
>
<Layout style={{ flex: 1 }}>
<SafeAreaView style={{ flex: 1, position: "relative" }}>
{session ? (
<>
<HomeScreen/>
</>
) : (
<>
<LoginScreen />
</>
)}
</SafeAreaView>
</Layout>
</ApplicationProvider>
</>
);
};
const styles = StyleSheet.create({
container: {
backgroundColor: "white",
justifyContent: "center",
alignItems: "center",
flex: 1,
},
});