don't change bg color on ios

This commit is contained in:
Samuel Newman
2024-04-17 01:08:40 +01:00
parent d4f6e84f29
commit 89f51c72fc
+9 -5
View File
@@ -1,11 +1,11 @@
import React from 'react' import React from 'react'
import {ColorSchemeName, useColorScheme} from 'react-native' import {ColorSchemeName, useColorScheme} from 'react-native'
import {useThemePrefs} from 'state/shell'
import {isWeb} from 'platform/detection'
import {ThemeName, light, dark, dim} from '#/alf/themes'
import * as SystemUI from 'expo-system-ui' import * as SystemUI from 'expo-system-ui'
import {isIOS, isWeb} from 'platform/detection'
import {useThemePrefs} from 'state/shell'
import {dark, dim, light, ThemeName} from '#/alf/themes'
export function useColorModeTheme(): ThemeName { export function useColorModeTheme(): ThemeName {
const colorScheme = useColorScheme() const colorScheme = useColorScheme()
const {colorMode, darkTheme} = useThemePrefs() const {colorMode, darkTheme} = useThemePrefs()
@@ -13,7 +13,11 @@ export function useColorModeTheme(): ThemeName {
React.useLayoutEffect(() => { React.useLayoutEffect(() => {
const theme = getThemeName(colorScheme, colorMode, darkTheme) const theme = getThemeName(colorScheme, colorMode, darkTheme)
updateDocument(theme) updateDocument(theme)
SystemUI.setBackgroundColorAsync(getBackgroundColor(theme))
// must be default on iOS due to the formSheet modal presentation style
if (!isIOS) {
SystemUI.setBackgroundColorAsync(getBackgroundColor(theme))
}
}, [colorMode, colorScheme, darkTheme]) }, [colorMode, colorScheme, darkTheme])
return React.useMemo( return React.useMemo(