Skip to content

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

fix(mobile): fix headers in android app

Mohamed Bassem349fe05e79f1
diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsx
index ab0f9c52..a559b4eb 100644
--- a/apps/mobile/app/_layout.tsx
+++ b/apps/mobile/app/_layout.tsx
@@ -56,7 +56,9 @@ export default function RootLayout() {
)}
screenOptions={{
headerTitle: "",
- headerTransparent: true,
+ ...Platform.select({
+ ios: { headerTransparent: true },
+ }),
}}
>
<Stack.Screen name="index" />
diff --git a/apps/mobile/app/dashboard/(tabs)/(highlights)/_layout.tsx b/apps/mobile/app/dashboard/(tabs)/(highlights)/_layout.tsx
index 961df836..704e4563 100644
--- a/apps/mobile/app/dashboard/(tabs)/(highlights)/_layout.tsx
+++ b/apps/mobile/app/dashboard/(tabs)/(highlights)/_layout.tsx
@@ -1,15 +1,20 @@
+import { Platform } from "react-native";
import { Stack } from "expo-router/stack";
export default function Layout() {
return (
<Stack
screenOptions={{
- headerLargeTitle: true,
- headerTransparent: true,
- headerBlurEffect: "systemMaterial",
+ ...Platform.select({
+ ios: {
+ headerLargeTitle: true,
+ headerTransparent: true,
+ headerBlurEffect: "systemMaterial",
+ headerLargeTitleShadowVisible: false,
+ headerLargeStyle: { backgroundColor: "transparent" },
+ },
+ }),
headerShadowVisible: false,
- headerLargeTitleShadowVisible: false,
- headerLargeStyle: { backgroundColor: "transparent" },
}}
>
<Stack.Screen name="index" options={{ title: "Highlights" }} />
diff --git a/apps/mobile/app/dashboard/(tabs)/(home)/_layout.tsx b/apps/mobile/app/dashboard/(tabs)/(home)/_layout.tsx
index 1ba65211..889b0875 100644
--- a/apps/mobile/app/dashboard/(tabs)/(home)/_layout.tsx
+++ b/apps/mobile/app/dashboard/(tabs)/(home)/_layout.tsx
@@ -1,15 +1,20 @@
+import { Platform } from "react-native";
import { Stack } from "expo-router/stack";
export default function Layout() {
return (
<Stack
screenOptions={{
- headerLargeTitle: true,
- headerTransparent: true,
- headerBlurEffect: "systemMaterial",
+ ...Platform.select({
+ ios: {
+ headerLargeTitle: true,
+ headerTransparent: true,
+ headerBlurEffect: "systemMaterial",
+ headerLargeTitleShadowVisible: false,
+ headerLargeStyle: { backgroundColor: "transparent" },
+ },
+ }),
headerShadowVisible: false,
- headerLargeTitleShadowVisible: false,
- headerLargeStyle: { backgroundColor: "transparent" },
}}
>
<Stack.Screen name="index" options={{ title: "Home" }} />
diff --git a/apps/mobile/app/dashboard/(tabs)/(lists)/_layout.tsx b/apps/mobile/app/dashboard/(tabs)/(lists)/_layout.tsx
index 398ba650..9de0af66 100644
--- a/apps/mobile/app/dashboard/(tabs)/(lists)/_layout.tsx
+++ b/apps/mobile/app/dashboard/(tabs)/(lists)/_layout.tsx
@@ -1,15 +1,20 @@
+import { Platform } from "react-native";
import { Stack } from "expo-router/stack";
export default function Layout() {
return (
<Stack
screenOptions={{
- headerLargeTitle: true,
- headerTransparent: true,
- headerBlurEffect: "systemMaterial",
+ ...Platform.select({
+ ios: {
+ headerLargeTitle: true,
+ headerTransparent: true,
+ headerBlurEffect: "systemMaterial",
+ headerLargeTitleShadowVisible: false,
+ headerLargeStyle: { backgroundColor: "transparent" },
+ },
+ }),
headerShadowVisible: false,
- headerLargeTitleShadowVisible: false,
- headerLargeStyle: { backgroundColor: "transparent" },
}}
>
<Stack.Screen name="index" options={{ title: "Lists" }} />
diff --git a/apps/mobile/app/dashboard/(tabs)/(settings)/_layout.tsx b/apps/mobile/app/dashboard/(tabs)/(settings)/_layout.tsx
index 8c51d5a3..79b2b19b 100644
--- a/apps/mobile/app/dashboard/(tabs)/(settings)/_layout.tsx
+++ b/apps/mobile/app/dashboard/(tabs)/(settings)/_layout.tsx
@@ -1,15 +1,20 @@
+import { Platform } from "react-native";
import { Stack } from "expo-router/stack";
export default function Layout() {
return (
<Stack
screenOptions={{
- headerLargeTitle: true,
- headerTransparent: true,
- headerBlurEffect: "systemMaterial",
+ ...Platform.select({
+ ios: {
+ headerLargeTitle: true,
+ headerTransparent: true,
+ headerBlurEffect: "systemMaterial",
+ headerLargeTitleShadowVisible: false,
+ headerLargeStyle: { backgroundColor: "transparent" },
+ },
+ }),
headerShadowVisible: false,
- headerLargeTitleShadowVisible: false,
- headerLargeStyle: { backgroundColor: "transparent" },
}}
>
<Stack.Screen name="index" options={{ title: "Settings" }} />
diff --git a/apps/mobile/app/dashboard/(tabs)/(tags)/_layout.tsx b/apps/mobile/app/dashboard/(tabs)/(tags)/_layout.tsx
index 3b56548f..5a9cee13 100644
--- a/apps/mobile/app/dashboard/(tabs)/(tags)/_layout.tsx
+++ b/apps/mobile/app/dashboard/(tabs)/(tags)/_layout.tsx
@@ -1,15 +1,20 @@
+import { Platform } from "react-native";
import { Stack } from "expo-router/stack";
export default function Layout() {
return (
<Stack
screenOptions={{
- headerLargeTitle: true,
- headerTransparent: true,
- headerBlurEffect: "systemMaterial",
+ ...Platform.select({
+ ios: {
+ headerLargeTitle: true,
+ headerTransparent: true,
+ headerBlurEffect: "systemMaterial",
+ headerLargeTitleShadowVisible: false,
+ headerLargeStyle: { backgroundColor: "transparent" },
+ },
+ }),
headerShadowVisible: false,
- headerLargeTitleShadowVisible: false,
- headerLargeStyle: { backgroundColor: "transparent" },
}}
>
<Stack.Screen name="index" options={{ title: "Tags" }} />
diff --git a/apps/mobile/app/dashboard/_layout.tsx b/apps/mobile/app/dashboard/_layout.tsx
index 00872b92..c5140db4 100644
--- a/apps/mobile/app/dashboard/_layout.tsx
+++ b/apps/mobile/app/dashboard/_layout.tsx
@@ -42,7 +42,9 @@ export default function Dashboard() {
contentClassName="bg-gray-100 dark:bg-background"
headerClassName="dark:text-white"
screenOptions={{
- headerTransparent: true,
+ ...Platform.select({
+ ios: { headerTransparent: true },
+ }),
}}
>
<Stack.Screen
@@ -54,7 +56,9 @@ export default function Dashboard() {
options={{
headerTitle: "",
headerBackTitle: "Back",
- headerTransparent: true,
+ ...Platform.select({
+ ios: { headerTransparent: true },
+ }),
}}
/>
<Stack.Screen
@@ -62,7 +66,9 @@ export default function Dashboard() {
options={{
headerTitle: "",
headerBackTitle: "Back",
- headerTransparent: true,
+ ...Platform.select({
+ ios: { headerTransparent: true },
+ }),
}}
/>
<Stack.Screen
@@ -108,8 +114,10 @@ export default function Dashboard() {
options={{
headerTitle: "New List",
headerBackTitle: "Back",
- headerTransparent: true,
presentation: "modal",
+ ...Platform.select({
+ ios: { headerTransparent: true },
+ }),
}}
/>
<Stack.Screen
@@ -117,8 +125,10 @@ export default function Dashboard() {
options={{
headerTitle: "Edit List",
headerBackTitle: "Back",
- headerTransparent: true,
presentation: "modal",
+ ...Platform.select({
+ ios: { headerTransparent: true },
+ }),
}}
/>
<Stack.Screen
@@ -126,7 +136,9 @@ export default function Dashboard() {
options={{
headerTitle: "",
headerBackTitle: "Back",
- headerTransparent: true,
+ ...Platform.select({
+ ios: { headerTransparent: true },
+ }),
}}
/>
<Stack.Screen
@@ -134,10 +146,12 @@ export default function Dashboard() {
options={{
headerTitle: "",
headerBackTitle: "",
- headerTransparent: true,
headerShown: false,
animation: "fade_from_bottom",
animationDuration: 100,
+ ...Platform.select({
+ ios: { headerTransparent: true },
+ }),
}}
/>
<Stack.Screen
diff --git a/apps/mobile/app/dashboard/archive.tsx b/apps/mobile/app/dashboard/archive.tsx
index b02088c8..a582cad6 100644
--- a/apps/mobile/app/dashboard/archive.tsx
+++ b/apps/mobile/app/dashboard/archive.tsx
@@ -1,4 +1,5 @@
import { useLayoutEffect } from "react";
+import { Platform } from "react-native";
import { useNavigation } from "expo-router";
import UpdatingBookmarkList from "@/components/bookmarks/UpdatingBookmarkList";
import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";
@@ -8,7 +9,9 @@ export default function Archive() {
useLayoutEffect(() => {
navigator.setOptions({
headerTitle: "🗄️ Archive",
- headerLargeTitle: true,
+ ...Platform.select({
+ ios: { headerLargeTitle: true },
+ }),
});
}, [navigator]);
return (
diff --git a/apps/mobile/app/dashboard/favourites.tsx b/apps/mobile/app/dashboard/favourites.tsx
index 3dd2aa09..6166ed66 100644
--- a/apps/mobile/app/dashboard/favourites.tsx
+++ b/apps/mobile/app/dashboard/favourites.tsx
@@ -1,4 +1,5 @@
import { useLayoutEffect } from "react";
+import { Platform } from "react-native";
import { useNavigation } from "expo-router";
import UpdatingBookmarkList from "@/components/bookmarks/UpdatingBookmarkList";
import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";
@@ -8,7 +9,9 @@ export default function Favourites() {
useLayoutEffect(() => {
navigator.setOptions({
headerTitle: "⭐️ Favourites",
- headerLargeTitle: true,
+ ...Platform.select({
+ ios: { headerLargeTitle: true },
+ }),
});
}, [navigator]);
return (
diff --git a/apps/mobile/app/dashboard/lists/[slug]/index.tsx b/apps/mobile/app/dashboard/lists/[slug]/index.tsx
index 763df65e..f074388d 100644
--- a/apps/mobile/app/dashboard/lists/[slug]/index.tsx
+++ b/apps/mobile/app/dashboard/lists/[slug]/index.tsx
@@ -30,7 +30,9 @@ export default function ListView() {
options={{
headerTitle: list ? `${list.icon} ${list.name}` : "",
headerBackTitle: "Back",
- headerLargeTitle: true,
+ ...Platform.select({
+ ios: { headerLargeTitle: true },
+ }),
headerRight: () => (
<ListActionsMenu listId={slug} role={list?.userRole ?? "viewer"} />
),
diff --git a/apps/mobile/app/dashboard/tags/[slug].tsx b/apps/mobile/app/dashboard/tags/[slug].tsx
index 328c65d0..2cdae41f 100644
--- a/apps/mobile/app/dashboard/tags/[slug].tsx
+++ b/apps/mobile/app/dashboard/tags/[slug].tsx
@@ -1,4 +1,4 @@
-import { View } from "react-native";
+import { Platform, View } from "react-native";
import { Stack, useLocalSearchParams } from "expo-router";
import UpdatingBookmarkList from "@/components/bookmarks/UpdatingBookmarkList";
import FullPageError from "@/components/FullPageError";
@@ -27,8 +27,9 @@ export default function TagView() {
options={{
headerTitle: tag?.name ?? "",
headerBackTitle: "Back",
- headerTransparent: true,
- headerLargeTitle: true,
+ ...Platform.select({
+ ios: { headerTransparent: true, headerLargeTitle: true },
+ }),
}}
/>
{error ? (
diff --git a/apps/mobile/components/ui/CustomSafeAreaView.tsx b/apps/mobile/components/ui/CustomSafeAreaView.tsx
index 8e7755c2..0dd4202d 100644
--- a/apps/mobile/components/ui/CustomSafeAreaView.tsx
+++ b/apps/mobile/components/ui/CustomSafeAreaView.tsx
@@ -1,3 +1,4 @@
+import { Platform } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { useColorScheme } from "@/lib/useColorScheme";
import { useHeaderHeight } from "@react-navigation/elements";
@@ -12,16 +13,19 @@ export default function CustomSafeAreaView({
const headerHeight = useHeaderHeight();
const { colors } = useColorScheme();
+ // Only add paddingTop on iOS where headers are transparent and don't take up layout space.
+ // On Android, headers are non-transparent and already push content down.
+ const paddingTop =
+ Platform.OS === "ios" && edges.includes("top") && headerHeight > 0
+ ? headerHeight
+ : undefined;
+
return (
<SafeAreaView
style={{
flex: 1,
backgroundColor: colors.background,
- paddingTop: edges.includes("top")
- ? headerHeight > 0
- ? headerHeight
- : undefined
- : undefined,
+ paddingTop,
}}
>
{children}