Respect chosen theme for splash

This commit is contained in:
Dan Abramov
2024-02-23 23:26:02 +00:00
parent 6ae9c5d45c
commit 47c5d1550c
+8 -8
View File
@@ -4,7 +4,6 @@ import {
StyleSheet, StyleSheet,
Image as RNImage, Image as RNImage,
AccessibilityInfo, AccessibilityInfo,
useColorScheme,
} from 'react-native' } from 'react-native'
import * as SplashScreen from 'expo-splash-screen' import * as SplashScreen from 'expo-splash-screen'
import {Image} from 'expo-image' import {Image} from 'expo-image'
@@ -22,6 +21,7 @@ import Svg, {Path, SvgProps} from 'react-native-svg'
import {isAndroid} from '#/platform/detection' import {isAndroid} from '#/platform/detection'
import {Logotype} from '#/view/icons/Logotype' import {Logotype} from '#/view/icons/Logotype'
import {useColorModeTheme} from './alf/util/useColorModeTheme'
// @ts-ignore // @ts-ignore
import splashImagePointer from '../assets/splash.png' import splashImagePointer from '../assets/splash.png'
@@ -74,8 +74,8 @@ export function Splash(props: React.PropsWithChildren<Props>) {
isLayoutReady && isLayoutReady &&
reduceMotion !== undefined reduceMotion !== undefined
const colorScheme = useColorScheme() const colorTheme = useColorModeTheme()
const isDarkMode = colorScheme === 'dark' const isLightMode = colorTheme === 'light'
const logoAnimation = useAnimatedStyle(() => { const logoAnimation = useAnimatedStyle(() => {
return { return {
@@ -189,7 +189,7 @@ export function Splash(props: React.PropsWithChildren<Props>) {
<Image <Image
accessibilityIgnoresInvertColors accessibilityIgnoresInvertColors
onLoadEnd={onLoadEnd} onLoadEnd={onLoadEnd}
source={{uri: isDarkMode ? darkSplashImageUri : splashImageUri}} source={{uri: isLightMode ? splashImageUri : darkSplashImageUri}}
style={StyleSheet.absoluteFillObject} style={StyleSheet.absoluteFillObject}
/> />
@@ -261,10 +261,10 @@ export function Splash(props: React.PropsWithChildren<Props>) {
style={[ style={[
StyleSheet.absoluteFillObject, StyleSheet.absoluteFillObject,
{ {
backgroundColor: isDarkMode backgroundColor: isLightMode
? // special off-spec color for dark mode ? '#fff'
'#0F1824' : // special off-spec color for dark mode
: '#fff', '#0F1824',
}, },
]} ]}
/> />