-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.jsx
36 lines (31 loc) · 914 Bytes
/
App.jsx
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
import React, {useState, useEffect} from 'react';
import {SafeAreaView, ScrollView} from 'react-native';
import Toast from 'react-native-toast-message';
import Hello from './pages/hello/Hello';
import Main from './pages/main/Main';
import {getSessionUserId} from './service/SessionService';
const App = () => {
const [userId, setUserId] = useState(0);
const [isSession, setIsSession] = useState(false);
useEffect(() => {
getSessionUserId(setUserId, setIsSession);
}, [userId]);
if (!isSession) {
return;
}
return (
<>
<SafeAreaView>
{userId === 0 ? (
<ScrollView contentInsetAdjustmentBehavior="automatic">
<Hello setUserId={setUserId} setIsSession={setIsSession} />
</ScrollView>
) : (
<Main userId={userId} setUserId={setUserId} />
)}
</SafeAreaView>
<Toast />
</>
);
};
export default App;