-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refacto]: replace expo-router by react navigation (#16)
- Loading branch information
1 parent
fc57766
commit f400121
Showing
37 changed files
with
474 additions
and
584 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import FontAwesome from "@expo/vector-icons/FontAwesome"; | ||
import { NavigationContainer } from "@react-navigation/native"; | ||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; | ||
import { useFonts } from "expo-font"; | ||
import * as SplashScreen from "expo-splash-screen"; | ||
import * as React from "react"; | ||
import { useEffect } from "react"; | ||
|
||
import { useInitializedApp } from "./src/hooks/useInitializedApp"; | ||
import { AuthStackNavigator } from "./src/navigation/AuthStack/AuthStackNavigator"; | ||
import { RegisterStackNavigator } from "./src/navigation/RegisterStackScreenNavigator/RegisterStackNavigator"; | ||
import { RootStackNavigator } from "./src/navigation/RootStackScreenNavigator/RootStackNavigator"; | ||
import ServiceInterface from "./src/tsyringe/ServiceInterface"; | ||
import { getGlobalInstance } from "./src/tsyringe/diUtils"; | ||
|
||
import "./src/tsyringe/tsyringe.config"; | ||
import AppService from "./src/services/AppService/AppService"; | ||
|
||
const queryClient = new QueryClient(); | ||
|
||
export default function WrappedApp() { | ||
return ( | ||
<QueryClientProvider client={queryClient}> | ||
<App /> | ||
</QueryClientProvider> | ||
); | ||
} | ||
|
||
function App() { | ||
const [loaded, error] = useFonts({ | ||
SpaceMono: require("./assets/fonts/SpaceMono-Regular.ttf"), | ||
...FontAwesome.font, | ||
}); | ||
const { isAppInitialized } = useInitializedApp(); | ||
const appService = getGlobalInstance<AppService>(ServiceInterface.AppService); | ||
const app = appService.useApp(); | ||
|
||
const Stack = () => { | ||
if (!app.isAuthenticated) { | ||
return <AuthStackNavigator />; | ||
} | ||
if (app.isProfileComplete) { | ||
return <RootStackNavigator />; | ||
} | ||
return <RegisterStackNavigator />; | ||
}; | ||
|
||
useEffect(() => { | ||
if (!loaded || !isAppInitialized) { | ||
return; | ||
} | ||
SplashScreen.hideAsync(); | ||
}, [loaded, isAppInitialized]); | ||
|
||
if (!loaded || !isAppInitialized) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<NavigationContainer> | ||
<Stack /> | ||
</NavigationContainer> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.