Skip to content

Commit dcec863

Browse files
committed
adjust bottom sheet for dark theme
1 parent 381e133 commit dcec863

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/contexts/ColorSchemeContext.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export type ColorSchemeName = Exclude<SettingColorSchemeName, 'system'>
77
export type ColorSchemeContextType = {
88
colorSchemeSetting: SettingColorSchemeName
99
colorScheme: ColorSchemeName
10+
isDarkTheme: boolean
1011
setColorSchemeSetting: (newColorScheme: SettingColorSchemeName) => void
1112
}
1213

src/design-system/bottomSheets/BottomSheet.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Box } from '@baca/design-system/components/Box'
2-
import { useSafeAreaInsets } from '@baca/hooks'
2+
import { useColorScheme } from '@baca/contexts'
3+
import { useSafeAreaInsets, useTheme } from '@baca/hooks'
34
import {
45
BottomSheetModal,
56
BottomSheetBackdrop,
@@ -26,6 +27,8 @@ export const BottomSheet = ({
2627
bottomSheetRef,
2728
}: BottomSheetProps) => {
2829
const { top } = useSafeAreaInsets()
30+
const { isDarkTheme } = useColorScheme()
31+
const { colors } = useTheme()
2932

3033
const handleClose = useCallback(() => {
3134
bottomSheetRef?.current?.snapToPosition(-1)
@@ -44,6 +47,12 @@ export const BottomSheet = ({
4447
snapPoints={[screenHeight - top - 24]}
4548
backdropComponent={renderBackdrop}
4649
enableDynamicSizing
50+
backgroundStyle={{
51+
backgroundColor: isDarkTheme ? colors.bg.primary : 'green',
52+
}}
53+
handleIndicatorStyle={{
54+
backgroundColor: isDarkTheme ? colors.alpha.black[100] : colors.alpha.white[100],
55+
}}
4756
>
4857
<BottomSheetView>
4958
<BottomSheetHeader

src/providers/ColorSchemeProvider.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,13 @@ export const ColorSchemeProvider: FC<PropsWithChildren> = ({ children }) => {
5454
[colorSchemeSetting, setItem]
5555
)
5656

57+
const isDarkTheme = useMemo(() => colorScheme === 'dark', [colorSchemeSetting])
58+
5759
const value: ColorSchemeContextType = useMemo(
5860
() => ({
5961
colorScheme,
6062
colorSchemeSetting,
63+
isDarkTheme,
6164
setColorSchemeSetting: setNewColorSchemeSetting,
6265
}),
6366
[colorScheme, colorSchemeSetting, setNewColorSchemeSetting]

0 commit comments

Comments
 (0)