|
|
|
@ -1,7 +1,5 @@
|
|
|
|
|
import React from 'react'; |
|
|
|
|
import { useSelector } from 'react-redux'; |
|
|
|
|
import { config } from '@gluestack-ui/config'; |
|
|
|
|
import { GluestackUIProvider } from '@gluestack-ui/themed'; |
|
|
|
|
import { NavigationContainer } from '@react-navigation/native'; |
|
|
|
|
import { navigationRef } from './RootNavigation'; |
|
|
|
|
import { createNativeStackNavigator } from '@react-navigation/native-stack'; |
|
|
|
@ -56,12 +54,12 @@ import PostScreen from '../screens/activity/projectAset/post/index';
|
|
|
|
|
import DialogFormPost from '../screens/activity/projectAset/post/dialogForm'; |
|
|
|
|
import ProjectScreen from '../screens/activity/projectAset/project/index'; |
|
|
|
|
import DialogFormProject from '../screens/activity/projectAset/project/dialogForm'; |
|
|
|
|
import ProfileScreen from '../screens/Profile'; |
|
|
|
|
|
|
|
|
|
const Stack = createNativeStackNavigator(); |
|
|
|
|
|
|
|
|
|
const AppRoutes = () => { |
|
|
|
|
// const { isLogin } = useSelector(state => state.userReducer)
|
|
|
|
|
|
|
|
|
|
const { isLogin, isRegister } = useSelector(state => state.userReducer) |
|
|
|
|
// setiap kali masuk aplikasi
|
|
|
|
|
React.useEffect(() => { |
|
|
|
|
setTimeout(async () => { |
|
|
|
@ -79,9 +77,11 @@ const AppRoutes = () => {
|
|
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<GluestackUIProvider config={config}> |
|
|
|
|
<NavigationContainer ref={navigationRef}> |
|
|
|
|
<Stack.Navigator initialRouteName='Login'> |
|
|
|
|
{ |
|
|
|
|
!isLogin ? |
|
|
|
|
( |
|
|
|
|
<> |
|
|
|
|
<Stack.Screen |
|
|
|
|
options={{ headerShown: false }} |
|
|
|
@ -89,7 +89,25 @@ const AppRoutes = () => {
|
|
|
|
|
component={LoginScreen} |
|
|
|
|
/> |
|
|
|
|
</> |
|
|
|
|
|
|
|
|
|
) : !isRegister ? ( |
|
|
|
|
<> |
|
|
|
|
<Stack.Screen |
|
|
|
|
options={{ headerShown: false }} |
|
|
|
|
name="Login" |
|
|
|
|
component={LoginScreen} |
|
|
|
|
/> |
|
|
|
|
<Stack.Screen |
|
|
|
|
options={{ headerShown: false }} |
|
|
|
|
name="RegisterScreen" |
|
|
|
|
component={RegisterScreen} |
|
|
|
|
/> |
|
|
|
|
<Stack.Screen |
|
|
|
|
options={{ headerShown: false }} |
|
|
|
|
name="SearchPage" |
|
|
|
|
component={SearchPage} |
|
|
|
|
/> |
|
|
|
|
</> |
|
|
|
|
) : ( |
|
|
|
|
<> |
|
|
|
|
<Stack.Screen |
|
|
|
|
options={{ headerShown: false }} |
|
|
|
@ -296,11 +314,16 @@ const AppRoutes = () => {
|
|
|
|
|
name="DialogFormPPE" |
|
|
|
|
component={DialogFormPPE} |
|
|
|
|
/> |
|
|
|
|
<Stack.Screen |
|
|
|
|
options={{ headerShown: false }} |
|
|
|
|
name="ProfileScreen" |
|
|
|
|
component={ProfileScreen} |
|
|
|
|
/> |
|
|
|
|
</> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
</Stack.Navigator> |
|
|
|
|
|
|
|
|
|
</NavigationContainer> |
|
|
|
|
</GluestackUIProvider> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|