2024-08-01 21:14:51 +00:00
|
|
|
import React, { useState, useEffect } from 'react';
|
2024-08-01 01:57:25 +00:00
|
|
|
import { router, Stack } from 'expo-router';
|
|
|
|
|
|
|
|
|
|
export const unstable_settings = {
|
|
|
|
|
// Ensure any route can link back to `/`
|
|
|
|
|
initialRouteName: 'login',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default function App() {
|
|
|
|
|
|
2024-08-01 21:14:51 +00:00
|
|
|
const [auth, setAuth] = useState(false);
|
|
|
|
|
|
2024-08-01 01:57:25 +00:00
|
|
|
useEffect(() => {
|
2024-08-01 21:14:51 +00:00
|
|
|
if (auth) {
|
|
|
|
|
router.replace('/explore');
|
|
|
|
|
} else {
|
|
|
|
|
router.replace('/login');
|
|
|
|
|
}
|
2024-08-01 01:57:25 +00:00
|
|
|
}, []);
|
|
|
|
|
|
2024-08-01 21:14:51 +00:00
|
|
|
useEffect(() => {
|
|
|
|
|
if (auth) {
|
|
|
|
|
router.replace('/explore');
|
|
|
|
|
} else {
|
|
|
|
|
router.replace('/login');
|
|
|
|
|
}
|
|
|
|
|
}, [auth]);
|
|
|
|
|
|
2024-08-01 01:57:25 +00:00
|
|
|
return (
|
|
|
|
|
<Stack
|
|
|
|
|
screenOptions={{
|
|
|
|
|
headerShown: false
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Stack.Screen name="login" />
|
|
|
|
|
<Stack.Screen name="register" />
|
2024-08-01 21:14:51 +00:00
|
|
|
<Stack.Screen name="explore" />
|
2024-08-01 01:57:25 +00:00
|
|
|
</Stack>
|
|
|
|
|
);
|
|
|
|
|
}
|