add theme to SafeAreaView and preventAutoHide SplashScreen (#592)

zio/stable
Ansh 2023-05-08 16:05:36 -04:00 committed by GitHub
parent 249d166811
commit 6124e52836
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View File

@ -5,7 +5,6 @@ import {withSentry} from 'lib/sentry'
import {Linking} from 'react-native' import {Linking} from 'react-native'
import {RootSiblingParent} from 'react-native-root-siblings' import {RootSiblingParent} from 'react-native-root-siblings'
import * as SplashScreen from 'expo-splash-screen' import * as SplashScreen from 'expo-splash-screen'
import {SafeAreaProvider} from 'react-native-safe-area-context'
import {GestureHandlerRootView} from 'react-native-gesture-handler' import {GestureHandlerRootView} from 'react-native-gesture-handler'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {ThemeProvider} from 'lib/ThemeContext' import {ThemeProvider} from 'lib/ThemeContext'
@ -18,6 +17,8 @@ import * as analytics from 'lib/analytics'
import * as Toast from './view/com/util/Toast' import * as Toast from './view/com/util/Toast'
import {handleLink} from './Navigation' import {handleLink} from './Navigation'
SplashScreen.preventAutoHideAsync()
const App = observer(() => { const App = observer(() => {
const [rootStore, setRootStore] = useState<RootStoreModel | undefined>( const [rootStore, setRootStore] = useState<RootStoreModel | undefined>(
undefined, undefined,
@ -55,9 +56,7 @@ const App = observer(() => {
<analytics.Provider> <analytics.Provider>
<RootStoreProvider value={rootStore}> <RootStoreProvider value={rootStore}>
<GestureHandlerRootView style={s.h100pct}> <GestureHandlerRootView style={s.h100pct}>
<SafeAreaProvider> <Shell />
<Shell />
</SafeAreaProvider>
</GestureHandlerRootView> </GestureHandlerRootView>
</RootStoreProvider> </RootStoreProvider>
</analytics.Provider> </analytics.Provider>

View File

@ -17,6 +17,7 @@ import * as backHandler from 'lib/routes/back-handler'
import {RoutesContainer, TabsNavigator} from '../../Navigation' import {RoutesContainer, TabsNavigator} from '../../Navigation'
import {isStateAtTabRoot} from 'lib/routes/helpers' import {isStateAtTabRoot} from 'lib/routes/helpers'
import {isAndroid} from 'platform/detection' import {isAndroid} from 'platform/detection'
import {SafeAreaProvider} from 'react-native-safe-area-context'
const ShellInner = observer(() => { const ShellInner = observer(() => {
const store = useStores() const store = useStores()
@ -78,12 +79,14 @@ export const Shell: React.FC = observer(() => {
const pal = usePalette('default') const pal = usePalette('default')
const theme = useTheme() const theme = useTheme()
return ( return (
<View testID="mobileShellView" style={[styles.outerContainer, pal.view]}> <SafeAreaProvider style={pal.view}>
<StatusBar style={theme.colorScheme === 'dark' ? 'light' : 'dark'} /> <View testID="mobileShellView" style={[styles.outerContainer, pal.view]}>
<RoutesContainer> <StatusBar style={theme.colorScheme === 'dark' ? 'light' : 'dark'} />
<ShellInner /> <RoutesContainer>
</RoutesContainer> <ShellInner />
</View> </RoutesContainer>
</View>
</SafeAreaProvider>
) )
}) })