Skip to content

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

fix(mobile): remove the use of custom safe areas

Mohamed Bassemef0b50beb63d
diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsx
index a559b4eb..b1ecc133 100644
--- a/apps/mobile/app/_layout.tsx
+++ b/apps/mobile/app/_layout.tsx
@@ -55,13 +55,24 @@ export default function RootLayout() {
colorScheme == "dark" ? "dark" : "light",
)}
screenOptions={{
- headerTitle: "",
...Platform.select({
- ios: { headerTransparent: true },
+ ios: {
+ headerTransparent: true,
+ headerBlurEffect: "systemMaterial",
+ headerLargeTitle: true,
+ headerLargeTitleShadowVisible: false,
+ headerLargeStyle: { backgroundColor: "transparent" },
+ },
}),
+ headerShadowVisible: false,
}}
>
- <Stack.Screen name="index" />
+ <Stack.Screen
+ name="index"
+ options={{
+ headerShown: false,
+ }}
+ />
<Stack.Screen
name="signin"
options={{
@@ -71,13 +82,29 @@ export default function RootLayout() {
title: "",
}}
/>
- <Stack.Screen name="sharing" />
+ <Stack.Screen
+ name="sharing"
+ options={{
+ headerShown: false,
+ }}
+ />
+ <Stack.Screen
+ name="+not-found"
+ options={{
+ headerShown: false,
+ }}
+ />
<Stack.Screen
name="server-address"
options={{
title: "Server Address",
headerShown: true,
- presentation: "modal",
+ headerTransparent: false,
+ headerLargeTitle: false,
+ presentation: Platform.select({
+ ios: "formSheet" as const,
+ default: "modal" as const,
+ }),
}}
/>
<Stack.Screen
@@ -85,7 +112,12 @@ export default function RootLayout() {
options={{
title: "Test Connection",
headerShown: true,
- presentation: "modal",
+ headerTransparent: false,
+ headerLargeTitle: false,
+ presentation: Platform.select({
+ ios: "formSheet" as const,
+ default: "modal" as const,
+ }),
}}
/>
</StyledStack>
diff --git a/apps/mobile/app/dashboard/_layout.tsx b/apps/mobile/app/dashboard/_layout.tsx
index 90fb6663..f8258f54 100644
--- a/apps/mobile/app/dashboard/_layout.tsx
+++ b/apps/mobile/app/dashboard/_layout.tsx
@@ -133,7 +133,12 @@ export default function Dashboard() {
headerTitle: "New List",
headerBackTitle: "Back",
headerLargeTitle: false,
- presentation: "modal",
+ headerTransparent: false,
+ presentation: Platform.select({
+ ios: "formSheet" as const,
+ default: "modal" as const,
+ }),
+ sheetGrabberVisible: true,
}}
/>
<Stack.Screen
@@ -142,7 +147,12 @@ export default function Dashboard() {
headerTitle: "Edit List",
headerBackTitle: "Back",
headerLargeTitle: false,
- presentation: "modal",
+ headerTransparent: false,
+ presentation: Platform.select({
+ ios: "formSheet" as const,
+ default: "modal" as const,
+ }),
+ sheetGrabberVisible: true,
}}
/>
<Stack.Screen
@@ -157,7 +167,9 @@ export default function Dashboard() {
options={{
headerTitle: "",
headerBackTitle: "",
- headerShown: false,
+ headerShown: true,
+ headerTransparent: false,
+ headerLargeTitle: false,
animation: "fade_from_bottom",
animationDuration: 100,
}}
@@ -168,7 +180,6 @@ export default function Dashboard() {
title: "Theme",
headerTitle: "Theme",
headerBackTitle: "Back",
- headerLargeTitle: false,
}}
/>
<Stack.Screen
@@ -177,7 +188,6 @@ export default function Dashboard() {
title: "Bookmark View Mode",
headerTitle: "Bookmark View Mode",
headerBackTitle: "Back",
- headerLargeTitle: false,
}}
/>
<Stack.Screen
@@ -186,7 +196,6 @@ export default function Dashboard() {
title: "Reader Settings",
headerTitle: "Reader Settings",
headerBackTitle: "Back",
- headerLargeTitle: false,
}}
/>
</StyledStack>
diff --git a/apps/mobile/app/dashboard/lists/[slug]/edit.tsx b/apps/mobile/app/dashboard/lists/[slug]/edit.tsx
index c1103b4d..449e03f2 100644
--- a/apps/mobile/app/dashboard/lists/[slug]/edit.tsx
+++ b/apps/mobile/app/dashboard/lists/[slug]/edit.tsx
@@ -2,7 +2,6 @@ import { useEffect, useState } from "react";
import { View } from "react-native";
import { router, useLocalSearchParams } from "expo-router";
import { Button } from "@/components/ui/Button";
-import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";
import FullPageSpinner from "@/components/ui/FullPageSpinner";
import { Input } from "@/components/ui/Input";
import { Text } from "@/components/ui/Text";
@@ -83,7 +82,7 @@ const EditListPage = () => {
const isPending = fetchIsPending || editIsPending;
return (
- <CustomSafeAreaView>
+ <>
{isPending ? (
<FullPageSpinner />
) : (
@@ -149,7 +148,7 @@ const EditListPage = () => {
</Button>
</View>
)}
- </CustomSafeAreaView>
+ </>
);
};
diff --git a/apps/mobile/app/dashboard/lists/new.tsx b/apps/mobile/app/dashboard/lists/new.tsx
index bada46f2..a446955c 100644
--- a/apps/mobile/app/dashboard/lists/new.tsx
+++ b/apps/mobile/app/dashboard/lists/new.tsx
@@ -2,7 +2,6 @@ import React, { useState } from "react";
import { View } from "react-native";
import { router } from "expo-router";
import { Button } from "@/components/ui/Button";
-import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";
import { Input } from "@/components/ui/Input";
import { Text } from "@/components/ui/Text";
import { useToast } from "@/components/ui/Toast";
@@ -60,66 +59,63 @@ const NewListPage = () => {
};
return (
- <CustomSafeAreaView>
- <View className="gap-3 px-4">
- {/* List Type Selector */}
- <View className="gap-2">
- <Text className="text-sm text-muted-foreground">List Type</Text>
- <View className="flex flex-row gap-2">
- <View className="flex-1">
- <Button
- variant={listType === "manual" ? "primary" : "secondary"}
- onPress={() => setListType("manual")}
- >
- <Text>Manual</Text>
- </Button>
- </View>
- <View className="flex-1">
- <Button
- variant={listType === "smart" ? "primary" : "secondary"}
- onPress={() => setListType("smart")}
- >
- <Text>Smart</Text>
- </Button>
- </View>
+ <View className="gap-3 px-4">
+ {/* List Type Selector */}
+ <View className="gap-2">
+ <Text className="text-sm text-muted-foreground">List Type</Text>
+ <View className="flex flex-row gap-2">
+ <View className="flex-1">
+ <Button
+ variant={listType === "manual" ? "primary" : "secondary"}
+ onPress={() => setListType("manual")}
+ >
+ <Text>Manual</Text>
+ </Button>
+ </View>
+ <View className="flex-1">
+ <Button
+ variant={listType === "smart" ? "primary" : "secondary"}
+ onPress={() => setListType("smart")}
+ >
+ <Text>Smart</Text>
+ </Button>
</View>
</View>
+ </View>
+
+ {/* List Name */}
+ <View className="flex flex-row items-center gap-1">
+ <Text className="shrink p-2">🚀</Text>
+ <Input
+ className="flex-1 bg-card"
+ onChangeText={setText}
+ placeholder="List Name"
+ autoFocus
+ autoCapitalize={"none"}
+ />
+ </View>
- {/* List Name */}
- <View className="flex flex-row items-center gap-1">
- <Text className="shrink p-2">🚀</Text>
+ {/* Smart List Query Input */}
+ {listType === "smart" && (
+ <View className="gap-2">
+ <Text className="text-sm text-muted-foreground">Search Query</Text>
<Input
- className="flex-1 bg-card"
- onChangeText={setText}
- placeholder="List Name"
- autoFocus
+ className="bg-card"
+ onChangeText={setQuery}
+ value={query}
+ placeholder="e.g., #important OR list:work"
autoCapitalize={"none"}
/>
+ <Text className="text-xs italic text-muted-foreground">
+ Smart lists automatically show bookmarks matching your search query
+ </Text>
</View>
+ )}
- {/* Smart List Query Input */}
- {listType === "smart" && (
- <View className="gap-2">
- <Text className="text-sm text-muted-foreground">Search Query</Text>
- <Input
- className="bg-card"
- onChangeText={setQuery}
- value={query}
- placeholder="e.g., #important OR list:work"
- autoCapitalize={"none"}
- />
- <Text className="text-xs italic text-muted-foreground">
- Smart lists automatically show bookmarks matching your search
- query
- </Text>
- </View>
- )}
-
- <Button disabled={isPending} onPress={onSubmit}>
- <Text>Save</Text>
- </Button>
- </View>
- </CustomSafeAreaView>
+ <Button disabled={isPending} onPress={onSubmit}>
+ <Text>Save</Text>
+ </Button>
+ </View>
);
};
diff --git a/apps/mobile/app/dashboard/search.tsx b/apps/mobile/app/dashboard/search.tsx
index d43f1aef..83f635ce 100644
--- a/apps/mobile/app/dashboard/search.tsx
+++ b/apps/mobile/app/dashboard/search.tsx
@@ -1,9 +1,8 @@
import { useMemo, useRef, useState } from "react";
import { FlatList, Keyboard, Pressable, TextInput, View } from "react-native";
-import { router, Stack } from "expo-router";
+import { router } from "expo-router";
import BookmarkList from "@/components/bookmarks/BookmarkList";
import FullPageError from "@/components/FullPageError";
-import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";
import FullPageSpinner from "@/components/ui/FullPageSpinner";
import { SearchInput } from "@/components/ui/SearchInput";
import { Text } from "@/components/ui/Text";
@@ -106,12 +105,7 @@ export default function Search() {
};
return (
- <CustomSafeAreaView>
- <Stack.Screen
- options={{
- headerShown: true,
- }}
- />
+ <>
<SearchInput
containerClassName="m-3"
ref={inputRef}
@@ -165,6 +159,6 @@ export default function Search() {
) : (
<View />
)}
- </CustomSafeAreaView>
+ </>
);
}
diff --git a/apps/mobile/app/dashboard/settings/bookmark-default-view.tsx b/apps/mobile/app/dashboard/settings/bookmark-default-view.tsx
index 5f4463ae..c791493b 100644
--- a/apps/mobile/app/dashboard/settings/bookmark-default-view.tsx
+++ b/apps/mobile/app/dashboard/settings/bookmark-default-view.tsx
@@ -1,6 +1,5 @@
-import { Pressable, View } from "react-native";
+import { Pressable, ScrollView, View } from "react-native";
import { useRouter } from "expo-router";
-import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";
import { Divider } from "@/components/ui/Divider";
import { Text } from "@/components/ui/Text";
import { useToast } from "@/components/ui/Toast";
@@ -56,12 +55,11 @@ export default function BookmarkDefaultViewSettings() {
options.pop();
return (
- <CustomSafeAreaView>
- <View className="flex h-full w-full items-center px-4 py-2">
- <View className="w-full rounded-lg bg-card bg-card px-4 py-2">
- {options}
- </View>
- </View>
- </CustomSafeAreaView>
+ <ScrollView
+ contentInsetAdjustmentBehavior="automatic"
+ contentContainerClassName="flex w-full items-center px-4 py-2"
+ >
+ <View className="w-full rounded-lg bg-card px-4 py-2">{options}</View>
+ </ScrollView>
);
}
diff --git a/apps/mobile/app/dashboard/settings/reader-settings.tsx b/apps/mobile/app/dashboard/settings/reader-settings.tsx
index 30ad54b9..31a8f914 100644
--- a/apps/mobile/app/dashboard/settings/reader-settings.tsx
+++ b/apps/mobile/app/dashboard/settings/reader-settings.tsx
@@ -6,7 +6,6 @@ import {
ReaderPreview,
ReaderPreviewRef,
} from "@/components/reader/ReaderPreview";
-import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";
import { Divider } from "@/components/ui/Divider";
import { Text } from "@/components/ui/Text";
import { MOBILE_FONT_FAMILIES, useReaderSettings } from "@/lib/readerSettings";
@@ -142,160 +141,159 @@ export default function ReaderSettingsPage() {
const fontFamilyOptions: ZReaderFontFamily[] = ["serif", "sans", "mono"];
return (
- <CustomSafeAreaView>
- <ScrollView
- className="w-full"
- contentContainerClassName="items-center gap-4 px-4 py-2"
- >
- {/* Font Family Selection */}
- <View className="w-full">
- <Text className="mb-2 px-1 text-sm font-medium text-muted-foreground">
- Font Family
- {localOverrides.fontFamily !== undefined && (
- <Text className="text-blue-500"> (local)</Text>
- )}
- </Text>
- <View className="w-full rounded-lg bg-card px-4 py-2">
- {fontFamilyOptions.map((fontFamily, index) => {
- const isChecked = effectiveFontFamily === fontFamily;
- return (
- <View key={fontFamily}>
- <Pressable
- onPress={() => handleFontFamilyChange(fontFamily)}
- className="flex flex-row items-center justify-between py-2"
+ <ScrollView
+ className="w-full"
+ contentContainerClassName="items-center gap-4 px-4 py-2"
+ contentInsetAdjustmentBehavior="automatic"
+ >
+ {/* Font Family Selection */}
+ <View className="w-full">
+ <Text className="mb-2 px-1 text-sm font-medium text-muted-foreground">
+ Font Family
+ {localOverrides.fontFamily !== undefined && (
+ <Text className="text-blue-500"> (local)</Text>
+ )}
+ </Text>
+ <View className="w-full rounded-lg bg-card px-4 py-2">
+ {fontFamilyOptions.map((fontFamily, index) => {
+ const isChecked = effectiveFontFamily === fontFamily;
+ return (
+ <View key={fontFamily}>
+ <Pressable
+ onPress={() => handleFontFamilyChange(fontFamily)}
+ className="flex flex-row items-center justify-between py-2"
+ >
+ <Text
+ style={{
+ fontFamily: MOBILE_FONT_FAMILIES[fontFamily],
+ }}
>
- <Text
- style={{
- fontFamily: MOBILE_FONT_FAMILIES[fontFamily],
- }}
- >
- {formatFontFamily(fontFamily)}
- </Text>
- {isChecked && <Check color="rgb(0, 122, 255)" />}
- </Pressable>
- {index < fontFamilyOptions.length - 1 && (
- <Divider orientation="horizontal" className="h-0.5" />
- )}
- </View>
- );
- })}
- </View>
+ {formatFontFamily(fontFamily)}
+ </Text>
+ {isChecked && <Check color="rgb(0, 122, 255)" />}
+ </Pressable>
+ {index < fontFamilyOptions.length - 1 && (
+ <Divider orientation="horizontal" className="h-0.5" />
+ )}
+ </View>
+ );
+ })}
</View>
+ </View>
- {/* Font Size */}
- <View className="w-full">
- <Text className="mb-2 px-1 text-sm font-medium text-muted-foreground">
- Font Size ({formatFontSize(displayFontSize)})
- {localOverrides.fontSize !== undefined && (
- <Text className="text-blue-500"> (local)</Text>
- )}
+ {/* Font Size */}
+ <View className="w-full">
+ <Text className="mb-2 px-1 text-sm font-medium text-muted-foreground">
+ Font Size ({formatFontSize(displayFontSize)})
+ {localOverrides.fontSize !== undefined && (
+ <Text className="text-blue-500"> (local)</Text>
+ )}
+ </Text>
+ <View className="flex w-full flex-row items-center gap-3 rounded-lg bg-card px-4 py-3">
+ <Text className="text-muted-foreground">
+ {READER_SETTING_CONSTRAINTS.fontSize.min}
</Text>
- <View className="flex w-full flex-row items-center gap-3 rounded-lg bg-card px-4 py-3">
- <Text className="text-muted-foreground">
- {READER_SETTING_CONSTRAINTS.fontSize.min}
- </Text>
- <View className="flex-1">
- <Slider
- progress={fontSizeProgress}
- minimumValue={fontSizeMin}
- maximumValue={fontSizeMax}
- renderBubble={() => null}
- onValueChange={(value) => {
- "worklet";
- runOnJS(updatePreviewFontSize)(Math.round(value));
- }}
- onSlidingComplete={(value) =>
- handleFontSizeChange(Math.round(value))
- }
- />
- </View>
- <Text className="text-muted-foreground">
- {READER_SETTING_CONSTRAINTS.fontSize.max}
- </Text>
+ <View className="flex-1">
+ <Slider
+ progress={fontSizeProgress}
+ minimumValue={fontSizeMin}
+ maximumValue={fontSizeMax}
+ renderBubble={() => null}
+ onValueChange={(value) => {
+ "worklet";
+ runOnJS(updatePreviewFontSize)(Math.round(value));
+ }}
+ onSlidingComplete={(value) =>
+ handleFontSizeChange(Math.round(value))
+ }
+ />
</View>
+ <Text className="text-muted-foreground">
+ {READER_SETTING_CONSTRAINTS.fontSize.max}
+ </Text>
</View>
+ </View>
- {/* Line Height */}
- <View className="w-full">
- <Text className="mb-2 px-1 text-sm font-medium text-muted-foreground">
- Line Height ({formatLineHeight(displayLineHeight)})
- {localOverrides.lineHeight !== undefined && (
- <Text className="text-blue-500"> (local)</Text>
- )}
+ {/* Line Height */}
+ <View className="w-full">
+ <Text className="mb-2 px-1 text-sm font-medium text-muted-foreground">
+ Line Height ({formatLineHeight(displayLineHeight)})
+ {localOverrides.lineHeight !== undefined && (
+ <Text className="text-blue-500"> (local)</Text>
+ )}
+ </Text>
+ <View className="flex w-full flex-row items-center gap-3 rounded-lg bg-card px-4 py-3">
+ <Text className="text-muted-foreground">
+ {READER_SETTING_CONSTRAINTS.lineHeight.min}
</Text>
- <View className="flex w-full flex-row items-center gap-3 rounded-lg bg-card px-4 py-3">
- <Text className="text-muted-foreground">
- {READER_SETTING_CONSTRAINTS.lineHeight.min}
- </Text>
- <View className="flex-1">
- <Slider
- progress={lineHeightProgress}
- minimumValue={lineHeightMin}
- maximumValue={lineHeightMax}
- renderBubble={() => null}
- onValueChange={(value) => {
- "worklet";
- runOnJS(updatePreviewLineHeight)(Math.round(value * 10) / 10);
- }}
- onSlidingComplete={handleLineHeightChange}
- />
- </View>
- <Text className="text-muted-foreground">
- {READER_SETTING_CONSTRAINTS.lineHeight.max}
- </Text>
+ <View className="flex-1">
+ <Slider
+ progress={lineHeightProgress}
+ minimumValue={lineHeightMin}
+ maximumValue={lineHeightMax}
+ renderBubble={() => null}
+ onValueChange={(value) => {
+ "worklet";
+ runOnJS(updatePreviewLineHeight)(Math.round(value * 10) / 10);
+ }}
+ onSlidingComplete={handleLineHeightChange}
+ />
</View>
- </View>
-
- {/* Preview */}
- <View className="w-full">
- <Text className="mb-2 px-1 text-sm font-medium text-muted-foreground">
- Preview
+ <Text className="text-muted-foreground">
+ {READER_SETTING_CONSTRAINTS.lineHeight.max}
</Text>
- <ReaderPreview
- ref={previewRef}
- initialFontFamily={effectiveFontFamily}
- initialFontSize={effectiveFontSize}
- initialLineHeight={effectiveLineHeight}
- />
</View>
+ </View>
- <Divider orientation="horizontal" className="my-2 w-full" />
+ {/* Preview */}
+ <View className="w-full">
+ <Text className="mb-2 px-1 text-sm font-medium text-muted-foreground">
+ Preview
+ </Text>
+ <ReaderPreview
+ ref={previewRef}
+ initialFontFamily={effectiveFontFamily}
+ initialFontSize={effectiveFontSize}
+ initialLineHeight={effectiveLineHeight}
+ />
+ </View>
- {/* Save as Default */}
+ <Divider orientation="horizontal" className="my-2 w-full" />
+
+ {/* Save as Default */}
+ <Pressable
+ onPress={handleSaveAsDefault}
+ disabled={!hasLocalOverrides}
+ className="w-full rounded-lg bg-card px-4 py-3"
+ >
+ <Text
+ className={`text-center ${hasLocalOverrides ? "text-blue-500" : "text-muted-foreground"}`}
+ >
+ Save as Default (All Devices)
+ </Text>
+ </Pressable>
+
+ {/* Clear Local */}
+ {hasLocalOverrides && (
<Pressable
- onPress={handleSaveAsDefault}
- disabled={!hasLocalOverrides}
- className="w-full rounded-lg bg-card px-4 py-3"
+ onPress={handleClearLocalOverrides}
+ className="flex w-full flex-row items-center justify-center gap-2 rounded-lg bg-card px-4 py-3"
>
- <Text
- className={`text-center ${hasLocalOverrides ? "text-blue-500" : "text-muted-foreground"}`}
- >
- Save as Default (All Devices)
- </Text>
+ <RotateCcw size={16} color={isDark ? "#9ca3af" : "#6b7280"} />
+ <Text className="text-muted-foreground">Clear Local Overrides</Text>
</Pressable>
+ )}
- {/* Clear Local */}
- {hasLocalOverrides && (
- <Pressable
- onPress={handleClearLocalOverrides}
- className="flex w-full flex-row items-center justify-center gap-2 rounded-lg bg-card px-4 py-3"
- >
- <RotateCcw size={16} color={isDark ? "#9ca3af" : "#6b7280"} />
- <Text className="text-muted-foreground">Clear Local Overrides</Text>
- </Pressable>
- )}
-
- {/* Clear Server */}
- {hasServerDefaults && (
- <Pressable
- onPress={handleClearServerDefaults}
- className="flex w-full flex-row items-center justify-center gap-2 rounded-lg bg-card px-4 py-3"
- >
- <RotateCcw size={16} color={isDark ? "#9ca3af" : "#6b7280"} />
- <Text className="text-muted-foreground">Clear Server Defaults</Text>
- </Pressable>
- )}
- </ScrollView>
- </CustomSafeAreaView>
+ {/* Clear Server */}
+ {hasServerDefaults && (
+ <Pressable
+ onPress={handleClearServerDefaults}
+ className="flex w-full flex-row items-center justify-center gap-2 rounded-lg bg-card px-4 py-3"
+ >
+ <RotateCcw size={16} color={isDark ? "#9ca3af" : "#6b7280"} />
+ <Text className="text-muted-foreground">Clear Server Defaults</Text>
+ </Pressable>
+ )}
+ </ScrollView>
);
}
diff --git a/apps/mobile/app/dashboard/settings/theme.tsx b/apps/mobile/app/dashboard/settings/theme.tsx
index a4f0494a..b1599bc3 100644
--- a/apps/mobile/app/dashboard/settings/theme.tsx
+++ b/apps/mobile/app/dashboard/settings/theme.tsx
@@ -1,5 +1,4 @@
-import { Pressable, View } from "react-native";
-import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";
+import { Pressable, ScrollView, View } from "react-native";
import { Divider } from "@/components/ui/Divider";
import { Text } from "@/components/ui/Text";
import useAppSettings from "@/lib/settings";
@@ -37,10 +36,11 @@ export default function ThemePage() {
options.pop();
return (
- <CustomSafeAreaView>
- <View className="flex h-full w-full items-center px-4 py-2">
- <View className="w-full rounded-lg bg-card px-4 py-2">{options}</View>
- </View>
- </CustomSafeAreaView>
+ <ScrollView
+ contentInsetAdjustmentBehavior="automatic"
+ contentContainerClassName="flex w-full items-center px-4 py-2"
+ >
+ <View className="w-full rounded-lg bg-card px-4 py-2">{options}</View>
+ </ScrollView>
);
}
diff --git a/apps/mobile/app/server-address.tsx b/apps/mobile/app/server-address.tsx
index 3b7b01d4..6ecef366 100644
--- a/apps/mobile/app/server-address.tsx
+++ b/apps/mobile/app/server-address.tsx
@@ -1,11 +1,9 @@
import { useState } from "react";
import { Pressable, View } from "react-native";
import { KeyboardAwareScrollView } from "react-native-keyboard-controller";
-import { Stack, useRouter } from "expo-router";
+import { useRouter } from "expo-router";
import { Button } from "@/components/ui/Button";
-import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";
import { Input } from "@/components/ui/Input";
-import PageTitle from "@/components/ui/PageTitle";
import { Text } from "@/components/ui/Text";
import useAppSettings from "@/lib/settings";
import { Plus, Trash2 } from "lucide-react-native";
@@ -90,142 +88,127 @@ export default function ServerAddress() {
};
return (
- <CustomSafeAreaView>
- <Stack.Screen
- options={{
- title: "Server Address",
- headerTransparent: true,
- }}
- />
- <PageTitle title="Server Address" />
- <KeyboardAwareScrollView
- className="w-full flex-1"
- contentContainerClassName="items-center gap-4 px-4 py-4"
- bottomOffset={20}
- keyboardShouldPersistTaps="handled"
- >
- {/* Error Message */}
- {error && (
- <View className="w-full rounded-lg bg-red-50 p-3 dark:bg-red-950">
- <Text className="text-center text-sm text-red-600 dark:text-red-400">
- {error}
- </Text>
- </View>
- )}
-
- {/* Server Address Section */}
- <View className="w-full">
- <Text className="mb-2 px-1 text-sm font-medium text-muted-foreground">
- Server URL
+ <KeyboardAwareScrollView
+ contentContainerClassName="items-center gap-4 px-4 py-4"
+ bottomOffset={20}
+ keyboardShouldPersistTaps="handled"
+ contentInsetAdjustmentBehavior="automatic"
+ >
+ {/* Error Message */}
+ {error && (
+ <View className="w-full rounded-lg bg-red-50 p-3 dark:bg-red-950">
+ <Text className="text-center text-sm text-red-600 dark:text-red-400">
+ {error}
</Text>
- <View className="w-full gap-3 rounded-lg bg-card px-4 py-4">
- <Text className="text-sm text-muted-foreground">
- Enter the URL of your Karakeep server
- </Text>
- <Input
- placeholder="https://cloud.karakeep.app"
- value={address}
- onChangeText={(text) => {
- setAddress(text);
- setError(undefined);
- }}
- autoCapitalize="none"
- keyboardType="url"
- autoFocus
- inputClasses="bg-background"
- />
- <Text className="text-xs text-muted-foreground">
- Must start with http:// or https://
- </Text>
- </View>
</View>
+ )}
+
+ {/* Server Address Section */}
+ <View className="w-full">
+ <Text className="mb-2 px-1 text-sm font-medium text-muted-foreground">
+ Server URL
+ </Text>
+ <View className="w-full gap-3 rounded-lg bg-card px-4 py-4">
+ <Text className="text-sm text-muted-foreground">
+ Enter the URL of your Karakeep server
+ </Text>
+ <Input
+ placeholder="https://cloud.karakeep.app"
+ value={address}
+ onChangeText={(text) => {
+ setAddress(text);
+ setError(undefined);
+ }}
+ autoCapitalize="none"
+ keyboardType="url"
+ autoFocus
+ inputClasses="bg-background"
+ />
+ <Text className="text-xs text-muted-foreground">
+ Must start with http:// or https://
+ </Text>
+ </View>
+ </View>
- {/* Custom Headers Section */}
- <View className="w-full">
- <Text className="mb-2 px-1 text-sm font-medium text-muted-foreground">
- Custom Headers
- {headers.length > 0 && (
- <Text className="text-muted-foreground"> ({headers.length})</Text>
- )}
+ {/* Custom Headers Section */}
+ <View className="w-full">
+ <Text className="mb-2 px-1 text-sm font-medium text-muted-foreground">
+ Custom Headers
+ {headers.length > 0 && (
+ <Text className="text-muted-foreground"> ({headers.length})</Text>
+ )}
+ </Text>
+ <View className="w-full gap-3 rounded-lg bg-card px-4 py-4">
+ <Text className="text-sm text-muted-foreground">
+ Add custom HTTP headers for API requests
</Text>
- <View className="w-full gap-3 rounded-lg bg-card px-4 py-4">
- <Text className="text-sm text-muted-foreground">
- Add custom HTTP headers for API requests
- </Text>
- {/* Existing Headers List */}
- {headers.length === 0 ? (
- <View className="py-4">
- <Text className="text-center text-sm text-muted-foreground">
- No custom headers configured
- </Text>
- </View>
- ) : (
- <View className="gap-2">
- {headers.map((header, index) => (
- <View
- key={index}
- className="flex-row items-center gap-3 rounded-lg border border-border bg-background p-3"
- >
- <View className="flex-1 gap-1">
- <Text className="text-sm font-semibold">
- {header.key}
- </Text>
- <Text
- className="text-xs text-muted-foreground"
- numberOfLines={1}
- >
- {header.value}
- </Text>
- </View>
- <Pressable
- onPress={() => handleRemoveHeader(index)}
- className="rounded-md p-2"
- hitSlop={8}
+ {/* Existing Headers List */}
+ {headers.length === 0 ? (
+ <View className="py-4">
+ <Text className="text-center text-sm text-muted-foreground">
+ No custom headers configured
+ </Text>
+ </View>
+ ) : (
+ <View className="gap-2">
+ {headers.map((header, index) => (
+ <View
+ key={index}
+ className="flex-row items-center gap-3 rounded-lg border border-border bg-background p-3"
+ >
+ <View className="flex-1 gap-1">
+ <Text className="text-sm font-semibold">{header.key}</Text>
+ <Text
+ className="text-xs text-muted-foreground"
+ numberOfLines={1}
>
- <Trash2 size={18} color="#ef4444" />
- </Pressable>
+ {header.value}
+ </Text>
</View>
- ))}
- </View>
- )}
-
- {/* Add New Header Form */}
- <View className="gap-2 border-t border-border pt-4">
- <Text className="text-sm font-medium">Add New Header</Text>
- <Input
- placeholder="Header Name (e.g., X-Custom-Header)"
- value={newHeaderKey}
- onChangeText={setNewHeaderKey}
- autoCapitalize="none"
- inputClasses="bg-background"
- />
- <Input
- placeholder="Header Value"
- value={newHeaderValue}
- onChangeText={setNewHeaderValue}
- autoCapitalize="none"
- inputClasses="bg-background"
- />
- <Button
- variant="secondary"
- onPress={handleAddHeader}
- disabled={!newHeaderKey.trim() || !newHeaderValue.trim()}
- >
- <Plus size={16} color={iconColor} />
- <Text className="text-sm">Add Header</Text>
- </Button>
+ <Pressable
+ onPress={() => handleRemoveHeader(index)}
+ className="rounded-md p-2"
+ hitSlop={8}
+ >
+ <Trash2 size={18} color="#ef4444" />
+ </Pressable>
+ </View>
+ ))}
</View>
+ )}
+
+ {/* Add New Header Form */}
+ <View className="gap-2 border-t border-border pt-4">
+ <Text className="text-sm font-medium">Add New Header</Text>
+ <Input
+ placeholder="Header Name (e.g., X-Custom-Header)"
+ value={newHeaderKey}
+ onChangeText={setNewHeaderKey}
+ autoCapitalize="none"
+ inputClasses="bg-background"
+ />
+ <Input
+ placeholder="Header Value"
+ value={newHeaderValue}
+ onChangeText={setNewHeaderValue}
+ autoCapitalize="none"
+ inputClasses="bg-background"
+ />
+ <Button
+ variant="secondary"
+ onPress={handleAddHeader}
+ disabled={!newHeaderKey.trim() || !newHeaderValue.trim()}
+ >
+ <Plus size={16} color={iconColor} />
+ <Text className="text-sm">Add Header</Text>
+ </Button>
</View>
</View>
- </KeyboardAwareScrollView>
-
- {/* Fixed Save Button */}
- <View className="border-t border-border bg-background px-4 py-3">
- <Button onPress={handleSave} className="w-full">
- <Text className="font-semibold">Save</Text>
- </Button>
</View>
- </CustomSafeAreaView>
+ <Pressable onPress={handleSave} className="w-full items-center">
+ <Text className="font-semibold text-primary">Save</Text>
+ </Pressable>
+ </KeyboardAwareScrollView>
);
}
diff --git a/apps/mobile/app/test-connection.tsx b/apps/mobile/app/test-connection.tsx
index 7e1d5779..cecf69b2 100644
--- a/apps/mobile/app/test-connection.tsx
+++ b/apps/mobile/app/test-connection.tsx
@@ -2,7 +2,6 @@ import React from "react";
import { Platform, ScrollView, View } from "react-native";
import * as Clipboard from "expo-clipboard";
import { Button } from "@/components/ui/Button";
-import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";
import { Text } from "@/components/ui/Text";
import useAppSettings from "@/lib/settings";
import { buildApiHeaders, cn } from "@/lib/utils";
@@ -79,57 +78,58 @@ export default function TestConnection() {
}, [settings.address, randomId]);
return (
- <CustomSafeAreaView>
- <View className="m-4 flex flex-1 flex-col gap-2 p-2">
- <Button
- className="w-full"
- onPress={async () => {
- await Clipboard.setStringAsync(text);
- }}
- >
- <Text>Copy Diagnostics Result</Text>
- </Button>
- <Button
- className="w-full"
- variant="secondary"
- onPress={() => {
- setText("");
- setRandomId(Math.random());
- }}
- >
- <Text>Retry</Text>
- </Button>
- <View
+ <ScrollView
+ contentInsetAdjustmentBehavior="automatic"
+ contentContainerClassName="m-4 flex flex-1 flex-col gap-2"
+ >
+ <Button
+ className="w-full"
+ onPress={async () => {
+ await Clipboard.setStringAsync(text);
+ }}
+ >
+ <Text>Copy Diagnostics Result</Text>
+ </Button>
+ <Button
+ className="w-full"
+ variant="secondary"
+ onPress={() => {
+ setText("");
+ setRandomId(Math.random());
+ }}
+ >
+ <Text>Retry</Text>
+ </Button>
+ <View
+ className={cn(
+ "w-full rounded-md p-2",
+ status === "running" && "bg-primary/50",
+ status === "success" && "bg-green-500",
+ status === "error" && "bg-red-500",
+ )}
+ >
+ <Text
className={cn(
- "w-full rounded-md p-2",
- status === "running" && "bg-primary/50",
- status === "success" && "bg-green-500",
- status === "error" && "bg-red-500",
+ "w-full text-center",
+ status === "running" && "text-primary-foreground",
+ status === "success" && "text-white",
+ status === "error" && "text-white",
)}
>
- <Text
- className={cn(
- "w-full text-center",
- status === "running" && "text-primary-foreground",
- status === "success" && "text-white",
- status === "error" && "text-white",
- )}
- >
- {status === "running" && "Running connection test ..."}
- {status === "success" && "Connection test successful"}
- {status === "error" && "Connection test failed"}
- </Text>
- </View>
- <ScrollView className="border-1 border-md h-64 flex-1 border-border bg-input p-2 leading-6">
- <Text
- style={{
- fontFamily: Platform.OS === "ios" ? "Courier New" : "monospace",
- }}
- >
- {text}
- </Text>
- </ScrollView>
+ {status === "running" && "Running connection test ..."}
+ {status === "success" && "Connection test successful"}
+ {status === "error" && "Connection test failed"}
+ </Text>
</View>
- </CustomSafeAreaView>
+ <ScrollView className="border-1 border-md h-64 flex-1 border-border bg-input p-2 leading-6">
+ <Text
+ style={{
+ fontFamily: Platform.OS === "ios" ? "Courier New" : "monospace",
+ }}
+ >
+ {text}
+ </Text>
+ </ScrollView>
+ </ScrollView>
);
}
diff --git a/apps/mobile/components/ui/CustomSafeAreaView.tsx b/apps/mobile/components/ui/CustomSafeAreaView.tsx
deleted file mode 100644
index de3fb9c8..00000000
--- a/apps/mobile/components/ui/CustomSafeAreaView.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import { Platform } from "react-native";
-import { SafeAreaView } from "react-native-safe-area-context";
-import { useColorScheme } from "@/lib/useColorScheme";
-import { useHeaderHeight } from "@react-navigation/elements";
-
-export default function CustomSafeAreaView({
- children,
- edges = ["top", "bottom"],
-}: {
- children: React.ReactNode;
- edges?: ("top" | "bottom")[];
-}) {
- 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
- edges={edges}
- style={{
- flex: 1,
- backgroundColor: colors.background,
- paddingTop,
- }}
- >
- {children}
- </SafeAreaView>
- );
-}
diff --git a/apps/mobile/components/ui/PageTitle.tsx b/apps/mobile/components/ui/PageTitle.tsx
deleted file mode 100644
index 28afa408..00000000
--- a/apps/mobile/components/ui/PageTitle.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { Text } from "@/components/ui/Text";
-import { cx } from "class-variance-authority";
-
-export default function PageTitle({
- title,
- className,
-}: {
- title: string;
- className?: string;
-}) {
- return (
- <Text className={cx("p-4 text-4xl font-bold text-foreground", className)}>
- {title}
- </Text>
- );
-}