From b8e1f83a5ce433b6c79322fe9c172dc17fcb6090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Qu=E1=BB=91c=20Kh=C3=A1nh?= Date: Sun, 14 Jul 2024 14:56:25 +0700 Subject: [PATCH] feat(mobile): improve dark mode (#116) base on shadcn's zinc theme ![Simulator Screenshot - iPhone 15 Pro - 2024-07-14 at 14 23 27](https://github.com/user-attachments/assets/2f279966-ae3c-4007-a03c-2c263d34fc8b) ![Simulator Screenshot - iPhone 15 Pro - 2024-07-14 at 14 23 30](https://github.com/user-attachments/assets/4b69ef4d-48f1-4da4-9c3f-a998fdc1f17e) --- .../category/select-category-icon-field.tsx | 5 ++++ .../transaction/select-account-field.tsx | 4 ++++ .../transaction/select-category-field.tsx | 4 ++++ .../transaction/select-date-field.tsx | 4 ++++ .../transaction/transaction-form.tsx | 2 +- .../wallet/select-account-icon-field.tsx | 4 ++++ .../wallet/select-currency-field.tsx | 4 ++++ apps/mobile/global.css | 24 +++++++++---------- apps/mobile/lib/theme.ts | 6 ++--- 9 files changed, 41 insertions(+), 16 deletions(-) diff --git a/apps/mobile/components/category/select-category-icon-field.tsx b/apps/mobile/components/category/select-category-icon-field.tsx index 652aa817..2ef82648 100644 --- a/apps/mobile/components/category/select-category-icon-field.tsx +++ b/apps/mobile/components/category/select-category-icon-field.tsx @@ -1,10 +1,12 @@ import { BottomSheetBackdrop, BottomSheetModal } from '@gorhom/bottom-sheet' import { useMemo, useRef } from 'react' +import { useColorScheme } from '@/hooks/useColorScheme' import { CATEGORY_EXPENSE_ICONS, CATEGORY_INCOME_ICONS, } from '@/lib/icons/category-icons' +import { theme } from '@/lib/theme' import { sleep } from '@/lib/utils' import type { CategoryTypeType } from '@6pm/validation' import { useController } from 'react-hook-form' @@ -24,6 +26,8 @@ export function SelectCategoryIconField({ type: CategoryTypeType }) { const sheetRef = useRef(null) + const { colorScheme } = useColorScheme() + const { field: { onChange, onBlur, value }, // fieldState, @@ -54,6 +58,7 @@ export function SelectCategoryIconField({ enablePanDownToClose enableDismissOnClose keyboardBehavior="extend" + backgroundStyle={{ backgroundColor: theme[colorScheme].background }} backdropComponent={(props) => ( (null) const { i18n } = useLingui() @@ -66,6 +69,7 @@ export function SelectAccountField({ enableDynamicSizing enablePanDownToClose keyboardBehavior="extend" + backgroundStyle={{ backgroundColor: theme[colorScheme].background }} backdropComponent={(props) => ( (null) const { i18n } = useLingui() @@ -74,6 +77,7 @@ export function SelectCategoryField({ enableDynamicSizing enablePanDownToClose keyboardBehavior="extend" + backgroundStyle={{ backgroundColor: theme[colorScheme].background }} backdropComponent={(props) => ( void }) { const { bottom } = useSafeAreaInsets() + const { colorScheme } = useColorScheme() const sheetRef = useRef(null) const { field: { onChange, onBlur, value }, @@ -82,6 +85,7 @@ export function SelectDateField({ enableDynamicSizing enablePanDownToClose keyboardBehavior="extend" + backgroundStyle={{ backgroundColor: theme[colorScheme].background }} backdropComponent={(props) => ( diff --git a/apps/mobile/components/wallet/select-account-icon-field.tsx b/apps/mobile/components/wallet/select-account-icon-field.tsx index 1941d711..d94d330e 100644 --- a/apps/mobile/components/wallet/select-account-icon-field.tsx +++ b/apps/mobile/components/wallet/select-account-icon-field.tsx @@ -1,7 +1,9 @@ import { BottomSheetBackdrop, BottomSheetModal } from '@gorhom/bottom-sheet' import { useRef } from 'react' +import { useColorScheme } from '@/hooks/useColorScheme' import { WALLET_ICONS } from '@/lib/icons/wallet-icons' +import { theme } from '@/lib/theme' import { useController } from 'react-hook-form' import { Keyboard } from 'react-native' import { FullWindowOverlay } from 'react-native-screens' @@ -14,6 +16,7 @@ export function SelectAccountIconField({ }: { onSelect?: (currency: string) => void }) { + const { colorScheme } = useColorScheme() const sheetRef = useRef(null) const { field: { onChange, onBlur, value }, @@ -37,6 +40,7 @@ export function SelectAccountIconField({ index={0} enableDynamicSizing enablePanDownToClose + backgroundStyle={{ backgroundColor: theme[colorScheme].background }} keyboardBehavior="extend" backdropComponent={(props) => ( void }) { const sheetRef = useRef(null) + const { colorScheme } = useColorScheme() const { field: { onChange, onBlur, value }, // fieldState, @@ -36,6 +39,7 @@ export function SelectCurrencyField({ index={0} snapPoints={['50%', '87%']} enablePanDownToClose + backgroundStyle={{ backgroundColor: theme[colorScheme].background }} keyboardBehavior="extend" backdropComponent={(props) => (