diff options
| author | MohamedBassem <me@mbassem.com> | 2024-04-17 17:56:21 +0100 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-04-17 18:13:31 +0100 |
| commit | c46482cdaaf883971736488750513663dd023076 (patch) | |
| tree | 9e3d70fd9e7ae39f8ef21e0651049558e5c5fa5b /apps/mobile/app | |
| parent | bb44ebcb9967bde81d15e2f7858d515777681c10 (diff) | |
| download | karakeep-c46482cdaaf883971736488750513663dd023076.tar.zst | |
mobile: Add dark mode support
Diffstat (limited to 'apps/mobile/app')
| -rw-r--r-- | apps/mobile/app/_layout.tsx | 16 | ||||
| -rw-r--r-- | apps/mobile/app/dashboard/(tabs)/_layout.tsx | 16 | ||||
| -rw-r--r-- | apps/mobile/app/dashboard/(tabs)/lists.tsx | 4 | ||||
| -rw-r--r-- | apps/mobile/app/dashboard/(tabs)/search.tsx | 2 | ||||
| -rw-r--r-- | apps/mobile/app/dashboard/(tabs)/settings.tsx | 4 | ||||
| -rw-r--r-- | apps/mobile/app/dashboard/_layout.tsx | 8 | ||||
| -rw-r--r-- | apps/mobile/app/dashboard/add-link.tsx | 1 | ||||
| -rw-r--r-- | apps/mobile/app/dashboard/add-note.tsx | 1 | ||||
| -rw-r--r-- | apps/mobile/app/sharing.tsx | 6 | ||||
| -rw-r--r-- | apps/mobile/app/signin.tsx | 12 |
10 files changed, 44 insertions, 26 deletions
diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsx index f36c9eec..a5aafb8c 100644 --- a/apps/mobile/app/_layout.tsx +++ b/apps/mobile/app/_layout.tsx @@ -7,11 +7,15 @@ import { useRouter } from "expo-router"; import { Stack } from "expo-router/stack"; import { ShareIntentProvider, useShareIntent } from "expo-share-intent"; import { StatusBar } from "expo-status-bar"; +import { StyledStack } from "@/components/navigation/stack"; import { Providers } from "@/lib/providers"; +import { cn } from "@/lib/utils"; +import { useColorScheme } from "nativewind"; export default function RootLayout() { const router = useRouter(); const { hasShareIntent } = useShareIntent(); + const { colorScheme } = useColorScheme(); useEffect(() => { if (hasShareIntent) { @@ -24,8 +28,14 @@ export default function RootLayout() { return ( <ShareIntentProvider> <Providers> - <View className="w-full flex-1 bg-background"> - <Stack + <View + className={cn( + "w-full flex-1 bg-gray-100 text-foreground dark:bg-background", + colorScheme == "dark" ? "dark" : "light", + )} + > + <StyledStack + contentClassName="bg-gray-100 dark:bg-background" screenOptions={{ headerShown: false, }} @@ -37,7 +47,7 @@ export default function RootLayout() { presentation: "modal", }} /> - </Stack> + </StyledStack> <StatusBar style="auto" /> </View> </Providers> diff --git a/apps/mobile/app/dashboard/(tabs)/_layout.tsx b/apps/mobile/app/dashboard/(tabs)/_layout.tsx index 7967b5c6..cf7e473f 100644 --- a/apps/mobile/app/dashboard/(tabs)/_layout.tsx +++ b/apps/mobile/app/dashboard/(tabs)/_layout.tsx @@ -1,17 +1,13 @@ -import React, { useEffect } from "react"; -import { Platform } from "react-native"; -import * as NavigationBar from "expo-navigation-bar"; +import React from "react"; import { Tabs } from "expo-router"; +import { StyledTabs } from "@/components/navigation/tabs"; import { ClipboardList, Home, Search, Settings } from "lucide-react-native"; export default function TabLayout() { - useEffect(() => { - if (Platform.OS == "android") { - NavigationBar.setBackgroundColorAsync("white"); - } - }, []); return ( - <Tabs + <StyledTabs + tabBarClassName="bg-gray-100 dark:bg-background pt-3" + sceneContainerClassName="bg-gray-100 dark:bg-background" screenOptions={{ headerShown: false, }} @@ -44,6 +40,6 @@ export default function TabLayout() { tabBarIcon: ({ color }) => <Settings color={color} />, }} /> - </Tabs> + </StyledTabs> ); } diff --git a/apps/mobile/app/dashboard/(tabs)/lists.tsx b/apps/mobile/app/dashboard/(tabs)/lists.tsx index 767b9256..53817bf2 100644 --- a/apps/mobile/app/dashboard/(tabs)/lists.tsx +++ b/apps/mobile/app/dashboard/(tabs)/lists.tsx @@ -57,8 +57,8 @@ export default function Lists() { }} renderItem={(l) => ( <Link asChild key={l.item.id} href={l.item.href}> - <Pressable className="mx-2 flex flex-row justify-between rounded-xl border border-gray-100 bg-white px-4 py-2"> - <Text className="text-lg"> + <Pressable className="mx-2 flex flex-row justify-between rounded-xl border border-input bg-white px-4 py-2 dark:bg-accent"> + <Text className="text-lg text-accent-foreground"> {l.item.logo} {l.item.name} </Text> <ChevronRight color="rgb(0, 122, 255)" /> diff --git a/apps/mobile/app/dashboard/(tabs)/search.tsx b/apps/mobile/app/dashboard/(tabs)/search.tsx index 0a4dcbfd..1a79b921 100644 --- a/apps/mobile/app/dashboard/(tabs)/search.tsx +++ b/apps/mobile/app/dashboard/(tabs)/search.tsx @@ -34,7 +34,7 @@ export default function Search() { <PageTitle title="Search" /> <Input placeholder="Search" - className="mx-4 bg-white" + className="mx-4" value={search} onChangeText={setSearch} autoFocus diff --git a/apps/mobile/app/dashboard/(tabs)/settings.tsx b/apps/mobile/app/dashboard/(tabs)/settings.tsx index c2db2846..93033926 100644 --- a/apps/mobile/app/dashboard/(tabs)/settings.tsx +++ b/apps/mobile/app/dashboard/(tabs)/settings.tsx @@ -18,8 +18,8 @@ export default function Dashboard() { <CustomSafeAreaView> <PageTitle title="Settings" /> <View className="flex h-full w-full items-center gap-4 px-4 py-2"> - <View className="w-full rounded-lg bg-white px-4 py-2"> - <Text className="text-lg"> + <View className="w-full rounded-lg bg-white px-4 py-2 dark:bg-accent"> + <Text className="text-lg text-accent-foreground"> {isLoading ? "Loading ..." : data?.email} </Text> </View> diff --git a/apps/mobile/app/dashboard/_layout.tsx b/apps/mobile/app/dashboard/_layout.tsx index c9f7355b..7548a6db 100644 --- a/apps/mobile/app/dashboard/_layout.tsx +++ b/apps/mobile/app/dashboard/_layout.tsx @@ -3,6 +3,7 @@ import { useEffect } from "react"; import { AppState, Platform } from "react-native"; import { useRouter } from "expo-router"; import { Stack } from "expo-router/stack"; +import { StyledStack } from "@/components/navigation/stack"; import { useIsLoggedIn } from "@/lib/session"; import { focusManager } from "@tanstack/react-query"; @@ -29,7 +30,10 @@ export default function Dashboard() { }, []); return ( - <Stack> + <StyledStack + contentClassName="bg-gray-100 dark:bg-background" + headerClassName="bg-gray-100 dark:bg-background text-foreground" + > <Stack.Screen name="(tabs)" options={{ headerShown: false, title: "Home" }} @@ -64,6 +68,6 @@ export default function Dashboard() { presentation: "modal", }} /> - </Stack> + </StyledStack> ); } diff --git a/apps/mobile/app/dashboard/add-link.tsx b/apps/mobile/app/dashboard/add-link.tsx index 568a36b6..d913ac01 100644 --- a/apps/mobile/app/dashboard/add-link.tsx +++ b/apps/mobile/app/dashboard/add-link.tsx @@ -39,7 +39,6 @@ export default function AddNote() { <Text className="w-full text-center text-red-500">{error}</Text> )} <Input - className="bg-white" value={text} onChangeText={setText} placeholder="Link" diff --git a/apps/mobile/app/dashboard/add-note.tsx b/apps/mobile/app/dashboard/add-note.tsx index 1f903e94..40c97456 100644 --- a/apps/mobile/app/dashboard/add-note.tsx +++ b/apps/mobile/app/dashboard/add-note.tsx @@ -39,7 +39,6 @@ export default function AddNote() { <Text className="w-full text-center text-red-500">{error}</Text> )} <Input - className="bg-white" value={text} onChangeText={setText} multiline diff --git a/apps/mobile/app/sharing.tsx b/apps/mobile/app/sharing.tsx index c178d69e..bbeaeeee 100644 --- a/apps/mobile/app/sharing.tsx +++ b/apps/mobile/app/sharing.tsx @@ -66,7 +66,7 @@ function SaveBookmark({ setMode }: { setMode: (mode: Mode) => void }) { return ( <View className="flex flex-row gap-3"> - <Text className="text-4xl">Hoarding</Text> + <Text className="text-4xl text-foreground">Hoarding</Text> <ActivityIndicator /> </View> ); @@ -83,11 +83,11 @@ export default function Sharing() { break; } case "success": { - comp = <Text className="text-4xl">Hoarded!</Text>; + comp = <Text className="text-4xl text-foreground">Hoarded!</Text>; break; } case "error": { - comp = <Text className="text-4xl">Error!</Text>; + comp = <Text className="text-4xl text-foreground">Error!</Text>; break; } } diff --git a/apps/mobile/app/signin.tsx b/apps/mobile/app/signin.tsx index 80a5f219..c524d1e0 100644 --- a/apps/mobile/app/signin.tsx +++ b/apps/mobile/app/signin.tsx @@ -9,6 +9,7 @@ import { } from "react-native"; import { Redirect } from "expo-router"; import Logo from "@/components/Logo"; +import { TailwindResolver } from "@/components/TailwindResolver"; import { Button } from "@/components/ui/Button"; import { Input } from "@/components/ui/Input"; import useAppSettings from "@/lib/settings"; @@ -57,7 +58,16 @@ export default function Signin() { <TouchableWithoutFeedback onPress={Keyboard.dismiss}> <View className="flex h-full flex-col justify-center gap-2 px-4"> <View className="items-center"> - <Logo height={150} width={200} /> + <TailwindResolver + className="color-foreground" + comp={(styles) => ( + <Logo + height={150} + width={200} + fill={styles?.color?.toString()} + /> + )} + /> </View> {error && ( <Text className="w-full text-center text-red-500">{error}</Text> |
