Fix white flash on startup (#1759)

zio/stable
dan 2023-10-27 04:06:40 +01:00 committed by GitHub
parent 46f3265936
commit 3e5a64b454
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -34,7 +34,6 @@ const App = observer(function AppImpl() {
setRootStore(store) setRootStore(store)
analytics.init(store) analytics.init(store)
notifications.init(store) notifications.init(store)
SplashScreen.hideAsync()
Linking.getInitialURL().then((url: string | null) => { Linking.getInitialURL().then((url: string | null) => {
if (url) { if (url) {
handleLink(url) handleLink(url)

View File

@ -1,5 +1,6 @@
import * as React from 'react' import * as React from 'react'
import {StyleSheet} from 'react-native' import {StyleSheet} from 'react-native'
import * as SplashScreen from 'expo-splash-screen'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import { import {
NavigationContainer, NavigationContainer,
@ -462,6 +463,7 @@ function RoutesContainer({children}: React.PropsWithChildren<{}>) {
linking={LINKING} linking={LINKING}
theme={theme} theme={theme}
onReady={() => { onReady={() => {
SplashScreen.hideAsync()
// Register the navigation container with the Sentry instrumentation (only works on native) // Register the navigation container with the Sentry instrumentation (only works on native)
if (isNative) { if (isNative) {
const routingInstrumentation = getRoutingInstrumentation() const routingInstrumentation = getRoutingInstrumentation()

View File

@ -21,7 +21,10 @@ import {usePalette} from 'lib/hooks/usePalette'
import * as backHandler from 'lib/routes/back-handler' 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 {SafeAreaProvider} from 'react-native-safe-area-context' import {
SafeAreaProvider,
initialWindowMetrics,
} from 'react-native-safe-area-context'
import {useOTAUpdate} from 'lib/hooks/useOTAUpdate' import {useOTAUpdate} from 'lib/hooks/useOTAUpdate'
const ShellInner = observer(function ShellInnerImpl() { const ShellInner = observer(function ShellInnerImpl() {
@ -87,7 +90,7 @@ export const Shell: React.FC = observer(function ShellImpl() {
const pal = usePalette('default') const pal = usePalette('default')
const theme = useTheme() const theme = useTheme()
return ( return (
<SafeAreaProvider style={pal.view}> <SafeAreaProvider initialMetrics={initialWindowMetrics} style={pal.view}>
<View testID="mobileShellView" style={[styles.outerContainer, pal.view]}> <View testID="mobileShellView" style={[styles.outerContainer, pal.view]}>
<StatusBar style={theme.colorScheme === 'dark' ? 'light' : 'dark'} /> <StatusBar style={theme.colorScheme === 'dark' ? 'light' : 'dark'} />
<RoutesContainer> <RoutesContainer>