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