Respect chosen theme for splash
This commit is contained in:
+8
-8
@@ -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',
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user