2022-06-09 20:03:25 +02:00
|
|
|
import React, {useState, useEffect} from 'react'
|
2023-01-26 19:53:46 +01:00
|
|
|
import {SafeAreaProvider} from 'react-native-safe-area-context'
|
2023-03-13 22:01:43 +01:00
|
|
|
import {RootSiblingParent} from 'react-native-root-siblings'
|
2022-07-19 23:04:45 +02:00
|
|
|
import * as view from './view/index'
|
2022-07-19 22:37:24 +02:00
|
|
|
import {RootStoreModel, setupState, RootStoreProvider} from './state'
|
2023-03-13 22:01:43 +01:00
|
|
|
import {Shell} from './view/shell/index'
|
2023-01-27 05:08:10 +01:00
|
|
|
import {ToastContainer} from './view/com/util/Toast.web'
|
2022-06-09 20:03:25 +02:00
|
|
|
|
|
|
|
function App() {
|
2022-07-19 22:37:24 +02:00
|
|
|
const [rootStore, setRootStore] = useState<RootStoreModel | undefined>(
|
|
|
|
undefined,
|
|
|
|
)
|
2022-06-09 20:03:25 +02:00
|
|
|
|
|
|
|
// init
|
|
|
|
useEffect(() => {
|
2022-07-19 23:04:45 +02:00
|
|
|
view.setup()
|
2023-02-23 22:52:12 +01:00
|
|
|
setupState().then(store => {
|
|
|
|
setRootStore(store)
|
|
|
|
})
|
2022-06-09 20:03:25 +02:00
|
|
|
}, [])
|
|
|
|
|
|
|
|
// show nothing prior to init
|
|
|
|
if (!rootStore) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2023-03-13 22:01:43 +01:00
|
|
|
<RootSiblingParent>
|
|
|
|
<RootStoreProvider value={rootStore}>
|
|
|
|
<SafeAreaProvider>
|
|
|
|
<Shell />
|
|
|
|
</SafeAreaProvider>
|
|
|
|
<ToastContainer />
|
|
|
|
</RootStoreProvider>
|
|
|
|
</RootSiblingParent>
|
2022-06-09 20:03:25 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default App
|