From bf5c99cb10a0b35b0101bf8f9858c176889a0284 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sun, 1 Feb 2026 18:16:22 +0000 Subject: feat(mobile): use native tabs for mobile --- apps/mobile/app/dashboard/(tabs)/_layout.tsx | 117 +++++++++++------------ apps/mobile/components/navigation/tabs.tsx | 28 ------ apps/mobile/components/ui/CustomSafeAreaView.tsx | 3 + apps/mobile/package.json | 1 + pnpm-lock.yaml | 3 + 5 files changed, 62 insertions(+), 90 deletions(-) delete mode 100644 apps/mobile/components/navigation/tabs.tsx diff --git a/apps/mobile/app/dashboard/(tabs)/_layout.tsx b/apps/mobile/app/dashboard/(tabs)/_layout.tsx index 5cc6aa92..f3db822e 100644 --- a/apps/mobile/app/dashboard/(tabs)/_layout.tsx +++ b/apps/mobile/app/dashboard/(tabs)/_layout.tsx @@ -1,69 +1,62 @@ -import React, { useLayoutEffect } from "react"; -import { Tabs, useNavigation } from "expo-router"; -import { StyledTabs } from "@/components/navigation/tabs"; -import { useColorScheme } from "@/lib/useColorScheme"; +import React from "react"; import { - ClipboardList, - Highlighter, - Home, - Settings, - Tag, -} from "lucide-react-native"; + Icon, + Label, + NativeTabs, + VectorIcon, +} from "expo-router/unstable-native-tabs"; +import { useColorScheme } from "@/lib/useColorScheme"; +import MaterialCommunityIcons from "@expo/vector-icons/MaterialCommunityIcons"; export default function TabLayout() { const { colors } = useColorScheme(); - const navigation = useNavigation(); - // Hide the header on the parent screen - useLayoutEffect(() => { - navigation.setOptions({ - headerShown: false, - }); - }, [navigation]); - return ( - - , - }} - /> - , - }} - /> - , - }} - /> - , - }} - /> - , - }} - /> - + + + + } + /> + + + + + + } + /> + + + + + } + /> + + + + + + } + /> + + + + + } + /> + + + ); } diff --git a/apps/mobile/components/navigation/tabs.tsx b/apps/mobile/components/navigation/tabs.tsx deleted file mode 100644 index 83b1c6a7..00000000 --- a/apps/mobile/components/navigation/tabs.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { ViewStyle } from "react-native"; -import { Tabs } from "expo-router"; -import { cssInterop } from "nativewind"; - -function StyledTabsImpl({ - tabBarStyle, - headerStyle, - sceneStyle, - ...props -}: React.ComponentProps & { - tabBarStyle?: ViewStyle; - headerStyle?: ViewStyle; - sceneStyle?: ViewStyle; -}) { - props.screenOptions = { - ...props.screenOptions, - tabBarStyle, - headerStyle, - sceneStyle, - }; - return ; -} - -export const StyledTabs = cssInterop(StyledTabsImpl, { - tabBarClassName: "tabBarStyle", - headerClassName: "headerStyle", - sceneClassName: "sceneStyle", -}); diff --git a/apps/mobile/components/ui/CustomSafeAreaView.tsx b/apps/mobile/components/ui/CustomSafeAreaView.tsx index 33c9a765..8e7755c2 100644 --- a/apps/mobile/components/ui/CustomSafeAreaView.tsx +++ b/apps/mobile/components/ui/CustomSafeAreaView.tsx @@ -1,4 +1,5 @@ import { SafeAreaView } from "react-native-safe-area-context"; +import { useColorScheme } from "@/lib/useColorScheme"; import { useHeaderHeight } from "@react-navigation/elements"; export default function CustomSafeAreaView({ @@ -9,11 +10,13 @@ export default function CustomSafeAreaView({ edges?: ("top" | "bottom")[]; }) { const headerHeight = useHeaderHeight(); + const { colors } = useColorScheme(); return ( 0 ? headerHeight diff --git a/apps/mobile/package.json b/apps/mobile/package.json index 94ebc0e1..47ef533d 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -16,6 +16,7 @@ }, "dependencies": { "@expo/metro-runtime": "~6.1.2", + "@expo/vector-icons": "^15.0.3", "@karakeep/shared": "workspace:^0.1.0", "@karakeep/shared-react": "workspace:^0.1.0", "@karakeep/trpc": "workspace:^0.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a1ceb31e..44e8e6b0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -317,6 +317,9 @@ importers: '@expo/metro-runtime': specifier: ~6.1.2 version: 6.1.2(expo@54.0.31)(react-dom@19.2.3(react@19.2.3))(react-native@0.81.5(@babel/core@7.26.0)(@types/react@19.2.5)(react@19.2.3))(react@19.2.3) + '@expo/vector-icons': + specifier: ^15.0.3 + version: 15.0.3(expo-font@14.0.10(expo@54.0.31)(react-native@0.81.5(@babel/core@7.26.0)(@types/react@19.2.5)(react@19.2.3))(react@19.2.3))(react-native@0.81.5(@babel/core@7.26.0)(@types/react@19.2.5)(react@19.2.3))(react@19.2.3) '@karakeep/shared': specifier: workspace:^0.1.0 version: link:../../packages/shared -- cgit v1.2.3-70-g09d2