From 3e5a64b4545628f72f0060b08a26e93af8eed072 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 27 Oct 2023 04:06:40 +0100 Subject: [PATCH] Fix white flash on startup (#1759) --- src/App.native.tsx | 1 - src/Navigation.tsx | 2 ++ src/view/shell/index.tsx | 7 +++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/App.native.tsx b/src/App.native.tsx index f99e976c..011b0b60 100644 --- a/src/App.native.tsx +++ b/src/App.native.tsx @@ -34,7 +34,6 @@ const App = observer(function AppImpl() { setRootStore(store) analytics.init(store) notifications.init(store) - SplashScreen.hideAsync() Linking.getInitialURL().then((url: string | null) => { if (url) { handleLink(url) diff --git a/src/Navigation.tsx b/src/Navigation.tsx index e1d5e76a..86c097ce 100644 --- a/src/Navigation.tsx +++ b/src/Navigation.tsx @@ -1,5 +1,6 @@ import * as React from 'react' import {StyleSheet} from 'react-native' +import * as SplashScreen from 'expo-splash-screen' import {observer} from 'mobx-react-lite' import { NavigationContainer, @@ -462,6 +463,7 @@ function RoutesContainer({children}: React.PropsWithChildren<{}>) { linking={LINKING} theme={theme} onReady={() => { + SplashScreen.hideAsync() // Register the navigation container with the Sentry instrumentation (only works on native) if (isNative) { const routingInstrumentation = getRoutingInstrumentation() diff --git a/src/view/shell/index.tsx b/src/view/shell/index.tsx index 3119715e..b564f99f 100644 --- a/src/view/shell/index.tsx +++ b/src/view/shell/index.tsx @@ -21,7 +21,10 @@ import {usePalette} from 'lib/hooks/usePalette' import * as backHandler from 'lib/routes/back-handler' import {RoutesContainer, TabsNavigator} from '../../Navigation' 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' const ShellInner = observer(function ShellInnerImpl() { @@ -87,7 +90,7 @@ export const Shell: React.FC = observer(function ShellImpl() { const pal = usePalette('default') const theme = useTheme() return ( - +