bsky-app/src/App.web.tsx

32 lines
708 B
TypeScript
Raw Normal View History

2022-06-09 20:03:25 +02:00
import React, {useState, useEffect} from 'react'
2022-07-19 23:04:45 +02:00
import * as view from './view/index'
import {RootStoreModel, setupState, RootStoreProvider} from './state'
import {DesktopWebShell} from './view/shell/desktop-web'
2023-01-26 18:25:52 +01:00
// import Toast from 'react-native-root-toast' TODO
2022-06-09 20:03:25 +02:00
function App() {
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()
2022-06-09 20:03:25 +02:00
setupState().then(setRootStore)
}, [])
// show nothing prior to init
if (!rootStore) {
return null
}
return (
<RootStoreProvider value={rootStore}>
<DesktopWebShell />
</RootStoreProvider>
2022-06-09 20:03:25 +02:00
)
2023-01-26 18:25:52 +01:00
// <Toast.ToastContainer /> TODO
2022-06-09 20:03:25 +02:00
}
export default App