/**
 * Welcome to the main entry point of the app. In this file, we'll
 * be kicking off our app.
 *
 * Most of this file is boilerplate and you shouldn't need to modify
 * it very often. But take some time to look through and understand
 * what is going on here.
 *
 * The app navigation resides in ./app/navigators, so head over there
 * if you're interested in adding screens and navigators.
 */ import "./i18n" ; import "./utils/ignore-warnings" ; import React , { useState , useEffect } from "react" ; import { SafeAreaProvider , initialWindowMetrics } from "react-native-safe-area-context" ; import { initFonts } from "./theme/fonts" ; import * as storage from "./utils/storage" ; import { AppNavigator , useNavigationPersistence } from "./navigators" ; import { RootStore , RootStoreProvider , setupRootStore } from "./models" ; import { ToggleStorybook } from "../storybook/toggle-storybook" ; import { ErrorBoundary } from "./screens/error/error-boundary" ; export const NAVIGATION_PERSISTENCE_KEY = "NAVIGATION_STATE" ; /**
 * This is the root component of our app.
 */ function App ( ) { const [ rootStore , setRootStore ] = useState < RootStore | undefined > ( undefined ) ; const { initialNavigationState , onNavigationStateChange , isRestored : isNavigationStateRestored , } = useNavigationPersistence ( storage , NAVIGATION_PERSISTENCE_KEY ) ; useEffect ( ( ) => { ; ( async ( ) => { await initFonts ( ) ; setupRootStore ( ) . then ( setRootStore ) ; } ) ( ) ; } , [ ] ) ; if ( ! rootStore || ! isNavigationStateRestored ) return null ; return ( < ToggleStorybook > < RootStoreProvider value = { rootStore } > < SafeAreaProvider initialMetrics = { initialWindowMetrics } > < ErrorBoundary catchErrors = { "always" } > < AppNavigator initialState = { initialNavigationState } onStateChange = { onNavigationStateChange } / > < /ErrorBoundary> < /SafeAreaProvider> < /RootStoreProvider> < /ToggleStorybook>); } export default App ;