Skip to content

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

feat(mobile): customizable reader toolbar (#2527)

Evan Simkowitz49c286896d3c
diff --git a/apps/mobile/app/dashboard/(tabs)/(settings)/index.tsx b/apps/mobile/app/dashboard/(tabs)/(settings)/index.tsx
index a7fc8bb3..52760995 100644
--- a/apps/mobile/app/dashboard/(tabs)/(settings)/index.tsx
+++ b/apps/mobile/app/dashboard/(tabs)/(settings)/index.tsx
@@ -203,6 +203,19 @@ export default function Settings() {
/>
</View>
<Divider orientation="horizontal" className="mx-6 my-1" />
+ <View className="flex flex-row items-center justify-between gap-8 px-4 py-1">
+ <Link
+ asChild
+ href="/dashboard/settings/toolbar-settings"
+ className="flex-1"
+ >
+ <Pressable className="flex flex-row justify-between">
+ <Text>Toolbar Buttons</Text>
+ <ChevronRight />
+ </Pressable>
+ </Link>
+ </View>
+ <Divider orientation="horizontal" className="mx-6 my-1" />
<View className="flex flex-row items-center justify-between gap-8 px-4 py-1">
<Text className="flex-1" numberOfLines={1}>
Keep screen on while reading
diff --git a/apps/mobile/app/dashboard/_layout.tsx b/apps/mobile/app/dashboard/_layout.tsx
index cd0b210d..1f9fc292 100644
--- a/apps/mobile/app/dashboard/_layout.tsx
+++ b/apps/mobile/app/dashboard/_layout.tsx
@@ -193,6 +193,14 @@ export default function Dashboard() {
headerBackTitle: "Back",
}}
/>
+ <Stack.Screen
+ name="settings/toolbar-settings"
+ options={{
+ title: "Toolbar Buttons",
+ headerTitle: "Toolbar Buttons",
+ headerBackTitle: "Back",
+ }}
+ />
</Stack>
);
}
diff --git a/apps/mobile/app/dashboard/bookmarks/[slug]/index.tsx b/apps/mobile/app/dashboard/bookmarks/[slug]/index.tsx
index 55270b85..fe388b57 100644
--- a/apps/mobile/app/dashboard/bookmarks/[slug]/index.tsx
+++ b/apps/mobile/app/dashboard/bookmarks/[slug]/index.tsx
@@ -12,7 +12,7 @@ import BookmarkTextView from "@/components/bookmarks/BookmarkTextView";
import BottomActions from "@/components/bookmarks/BottomActions";
import FullPageError from "@/components/FullPageError";
import FullPageSpinner from "@/components/ui/FullPageSpinner";
-import { isIOS26 } from "@/lib/ios";
+import { shouldUseGlassPill } from "@/lib/ios";
import useAppSettings from "@/lib/settings";
import { useQuery } from "@tanstack/react-query";
import { Settings } from "lucide-react-native";
@@ -87,7 +87,13 @@ export default function BookmarkView() {
}
return (
<KeyboardAvoidingView
- style={{ flex: 1, paddingBottom: insets.bottom + 8 }}
+ // On iOS 26 the toolbar is absolute-positioned so its GlassView has
+ // content behind it; its own bottomMargin handles the safe-area inset,
+ // so padding here would leave a visible gap below the glass pill.
+ style={{
+ flex: 1,
+ paddingBottom: shouldUseGlassPill ? 0 : insets.bottom + 8,
+ }}
behavior="height"
>
{settings.keepScreenOnWhileReading && <KeepScreenOn />}
@@ -104,7 +110,7 @@ export default function BookmarkView() {
headerRight: () =>
bookmark.content.type === BookmarkTypes.LINK ? (
<View
- className={`flex-row items-center gap-3${isIOS26 ? " px-2" : ""}`}
+ className={`flex-row items-center gap-3${shouldUseGlassPill ? " px-2" : ""}`}
>
{bookmarkLinkType === "reader" && (
<Pressable
@@ -125,7 +131,13 @@ export default function BookmarkView() {
}}
/>
{comp}
- <BottomActions bookmark={bookmark} />
+ {shouldUseGlassPill ? (
+ <View style={{ position: "absolute", left: 0, right: 0, bottom: 0 }}>
+ <BottomActions bookmark={bookmark} />
+ </View>
+ ) : (
+ <BottomActions bookmark={bookmark} />
+ )}
</KeyboardAvoidingView>
);
}
diff --git a/apps/mobile/app/dashboard/settings/toolbar-settings.tsx b/apps/mobile/app/dashboard/settings/toolbar-settings.tsx
new file mode 100644
index 00000000..71341a19
--- /dev/null
+++ b/apps/mobile/app/dashboard/settings/toolbar-settings.tsx
@@ -0,0 +1,233 @@
+import type { ToolbarActionId } from "@/lib/settings";
+import { useCallback } from "react";
+import { Pressable, ScrollView, TouchableOpacity, View } from "react-native";
+import DraggableFlatList, {
+ ScaleDecorator,
+} from "react-native-draggable-flatlist";
+import { TOOLBAR_ACTION_REGISTRY } from "@/components/bookmarks/BottomActions";
+import { TailwindResolver } from "@/components/TailwindResolver";
+import { Divider } from "@/components/ui/Divider";
+import { Text } from "@/components/ui/Text";
+import useAppSettings, {
+ DEFAULT_OVERFLOW_ACTIONS,
+ DEFAULT_TOOLBAR_ACTIONS,
+} from "@/lib/settings";
+import { GripVertical, Minus, Plus } from "lucide-react-native";
+
+const MAX_VISIBLE = 6;
+
+export default function ToolbarSettingsPage() {
+ const { settings, setSettings } = useAppSettings();
+
+ const visible = settings.toolbarActions;
+ const overflow = settings.overflowActions ?? [];
+
+ const save = useCallback(
+ (nextVisible: ToolbarActionId[], nextOverflow: ToolbarActionId[]) => {
+ setSettings({
+ ...settings,
+ toolbarActions: nextVisible,
+ overflowActions: nextOverflow,
+ });
+ },
+ [settings, setSettings],
+ );
+
+ const demoteToOverflow = useCallback(
+ (id: ToolbarActionId) => {
+ save(
+ visible.filter((a) => a !== id),
+ [...overflow, id],
+ );
+ },
+ [visible, overflow, save],
+ );
+
+ const promoteToVisible = useCallback(
+ (id: ToolbarActionId) => {
+ if (visible.length >= MAX_VISIBLE) return;
+ save(
+ [...visible, id],
+ overflow.filter((a) => a !== id),
+ );
+ },
+ [visible, overflow, save],
+ );
+
+ const resetToDefaults = () => {
+ save([...DEFAULT_TOOLBAR_ACTIONS], [...DEFAULT_OVERFLOW_ACTIONS]);
+ };
+
+ const renderVisibleItem = useCallback(
+ ({
+ item,
+ drag,
+ isActive,
+ }: {
+ item: ToolbarActionId;
+ drag: () => void;
+ isActive: boolean;
+ }) => {
+ const meta = TOOLBAR_ACTION_REGISTRY[item];
+ return (
+ <ScaleDecorator>
+ <TouchableOpacity
+ activeOpacity={0.7}
+ onLongPress={drag}
+ disabled={isActive}
+ className="flex flex-row items-center gap-3 bg-card px-4 py-3"
+ >
+ <TailwindResolver
+ className="text-muted-foreground"
+ comp={(styles) => (
+ <GripVertical size={18} color={styles?.color?.toString()} />
+ )}
+ />
+ <TailwindResolver
+ className="text-foreground"
+ comp={(styles) => (
+ <meta.Icon size={20} color={styles?.color?.toString()} />
+ )}
+ />
+ <Text className="flex-1">{meta.label}</Text>
+ <Pressable onPress={() => demoteToOverflow(item)} className="p-1.5">
+ <TailwindResolver
+ className="text-muted-foreground"
+ comp={(styles) => (
+ <Minus size={18} color={styles?.color?.toString()} />
+ )}
+ />
+ </Pressable>
+ </TouchableOpacity>
+ </ScaleDecorator>
+ );
+ },
+ [demoteToOverflow],
+ );
+
+ const renderOverflowItem = useCallback(
+ ({
+ item,
+ drag,
+ isActive,
+ }: {
+ item: ToolbarActionId;
+ drag: () => void;
+ isActive: boolean;
+ }) => {
+ const meta = TOOLBAR_ACTION_REGISTRY[item];
+ const canPromote = visible.length < MAX_VISIBLE;
+ return (
+ <ScaleDecorator>
+ <TouchableOpacity
+ activeOpacity={0.7}
+ onLongPress={drag}
+ disabled={isActive}
+ className="flex flex-row items-center gap-3 bg-card px-4 py-3"
+ >
+ <TailwindResolver
+ className="text-muted-foreground"
+ comp={(styles) => (
+ <GripVertical size={18} color={styles?.color?.toString()} />
+ )}
+ />
+ <TailwindResolver
+ className="text-muted-foreground"
+ comp={(styles) => (
+ <meta.Icon size={20} color={styles?.color?.toString()} />
+ )}
+ />
+ <Text className="flex-1 text-muted-foreground">{meta.label}</Text>
+ <Pressable
+ onPress={() => promoteToVisible(item)}
+ disabled={!canPromote}
+ className="p-1.5"
+ >
+ <TailwindResolver
+ className={
+ canPromote
+ ? "text-muted-foreground"
+ : "text-muted-foreground/30"
+ }
+ comp={(styles) => (
+ <Plus size={18} color={styles?.color?.toString()} />
+ )}
+ />
+ </Pressable>
+ </TouchableOpacity>
+ </ScaleDecorator>
+ );
+ },
+ [visible.length, promoteToVisible],
+ );
+
+ return (
+ <ScrollView
+ className="w-full"
+ contentContainerClassName="gap-4 px-4 py-2"
+ contentInsetAdjustmentBehavior="automatic"
+ >
+ <Text className="px-1 text-xs uppercase tracking-wide text-muted-foreground">
+ Visible Actions (max {MAX_VISIBLE})
+ </Text>
+ <View
+ className="w-full overflow-hidden rounded-xl bg-card"
+ style={{ borderCurve: "continuous" }}
+ >
+ {visible.length === 0 ? (
+ <View className="px-4 py-3">
+ <Text className="text-sm text-muted-foreground">
+ No visible actions. Only the overflow menu will show.
+ </Text>
+ </View>
+ ) : (
+ <DraggableFlatList
+ data={visible}
+ renderItem={renderVisibleItem}
+ keyExtractor={(item) => item}
+ onDragEnd={({ data }) => save(data, overflow)}
+ scrollEnabled={false}
+ ItemSeparatorComponent={() => (
+ <Divider orientation="horizontal" className="mx-6" />
+ )}
+ />
+ )}
+ </View>
+
+ <Text className="px-1 text-xs uppercase tracking-wide text-muted-foreground">
+ Overflow Actions
+ </Text>
+ <View
+ className="w-full overflow-hidden rounded-xl bg-card"
+ style={{ borderCurve: "continuous" }}
+ >
+ {overflow.length === 0 ? (
+ <View className="px-4 py-3">
+ <Text className="text-sm text-muted-foreground">
+ No overflow actions. All actions are visible on the toolbar.
+ </Text>
+ </View>
+ ) : (
+ <DraggableFlatList
+ data={overflow}
+ renderItem={renderOverflowItem}
+ keyExtractor={(item) => item}
+ onDragEnd={({ data }) => save(visible, data)}
+ scrollEnabled={false}
+ ItemSeparatorComponent={() => (
+ <Divider orientation="horizontal" className="mx-6" />
+ )}
+ />
+ )}
+ </View>
+
+ <Pressable
+ onPress={resetToDefaults}
+ className="w-full rounded-xl bg-card px-4 py-3"
+ style={{ borderCurve: "continuous" }}
+ >
+ <Text className="text-center text-blue-500">Reset to Defaults</Text>
+ </Pressable>
+ </ScrollView>
+ );
+}
diff --git a/apps/mobile/components/bookmarks/BookmarkCard.tsx b/apps/mobile/components/bookmarks/BookmarkCard.tsx
index e64c09ce..aff93faf 100644
--- a/apps/mobile/components/bookmarks/BookmarkCard.tsx
+++ b/apps/mobile/components/bookmarks/BookmarkCard.tsx
@@ -5,17 +5,14 @@ import {
Platform,
Pressable,
ScrollView,
- Share,
View,
} from "react-native";
-import * as Clipboard from "expo-clipboard";
-import * as FileSystem from "expo-file-system/legacy";
import * as Haptics from "expo-haptics";
import { Image } from "expo-image";
import { router, useRouter } from "expo-router";
-import * as Sharing from "expo-sharing";
import { Text } from "@/components/ui/Text";
import useAppSettings from "@/lib/settings";
+import { shareBookmark } from "@/lib/shareBookmark";
import { useMenuIconColors } from "@/lib/useMenuIconColors";
import { buildApiHeaders } from "@/lib/utils";
import { MenuView } from "@react-native-menu/menu";
@@ -101,93 +98,7 @@ function ActionBar({ bookmark }: { bookmark: ZBookmark }) {
],
);
- const handleShare = async () => {
- try {
- switch (bookmark.content.type) {
- case BookmarkTypes.LINK:
- await Share.share({
- url: bookmark.content.url,
- message: bookmark.content.url,
- });
- break;
-
- case BookmarkTypes.TEXT:
- await Clipboard.setStringAsync(bookmark.content.text);
- toast({
- message: "Text copied to clipboard",
- showProgress: false,
- });
- break;
-
- case BookmarkTypes.ASSET:
- if (bookmark.content.assetType === "image") {
- if (await Sharing.isAvailableAsync()) {
- const assetUrl = `${settings.address}/api/assets/${bookmark.content.assetId}`;
- const fileUri = `${FileSystem.documentDirectory}temp_image.jpg`;
-
- const downloadResult = await FileSystem.downloadAsync(
- assetUrl,
- fileUri,
- {
- headers: buildApiHeaders(
- settings.apiKey,
- settings.customHeaders,
- ),
- },
- );
-
- if (downloadResult.status === 200) {
- await Sharing.shareAsync(downloadResult.uri);
- // Clean up the temporary file
- await FileSystem.deleteAsync(downloadResult.uri, {
- idempotent: true,
- });
- } else {
- throw new Error("Failed to download image");
- }
- }
- } else if (bookmark.content.assetType === "pdf") {
- if (await Sharing.isAvailableAsync()) {
- const assetUrl = `${settings.address}/api/assets/${bookmark.content.assetId}`;
- const fileName = bookmark.content.fileName || "document.pdf";
- const fileUri = `${FileSystem.documentDirectory}${fileName}`;
-
- const downloadResult = await FileSystem.downloadAsync(
- assetUrl,
- fileUri,
- {
- headers: buildApiHeaders(
- settings.apiKey,
- settings.customHeaders,
- ),
- },
- );
-
- if (downloadResult.status === 200) {
- await Sharing.shareAsync(downloadResult.uri, {
- mimeType: "application/pdf",
- UTI: "com.adobe.pdf",
- });
- // Clean up the temporary file
- await FileSystem.deleteAsync(downloadResult.uri, {
- idempotent: true,
- });
- } else {
- throw new Error("Failed to download PDF");
- }
- }
- }
- break;
- }
- } catch (error) {
- console.error("Share error:", error);
- toast({
- message: "Failed to share",
- variant: "destructive",
- showProgress: false,
- });
- }
- };
+ const handleShare = () => shareBookmark(bookmark, settings, toast);
// Build actions array based on ownership
const menuActions = [];
diff --git a/apps/mobile/components/bookmarks/BottomActions.tsx b/apps/mobile/components/bookmarks/BottomActions.tsx
index 2dcb90d1..d953247c 100644
--- a/apps/mobile/components/bookmarks/BottomActions.tsx
+++ b/apps/mobile/components/bookmarks/BottomActions.tsx
@@ -1,23 +1,113 @@
-import { Alert, Linking, Pressable, View } from "react-native";
+import type { ToolbarActionId } from "@/lib/settings";
+import type { LucideIcon } from "lucide-react-native";
+import { Alert, Linking, Platform, Pressable, View } from "react-native";
+import { useSafeAreaInsets } from "react-native-safe-area-context";
+import { BlurView } from "expo-blur";
+import { GlassView } from "expo-glass-effect";
+import * as Haptics from "expo-haptics";
import { useRouter } from "expo-router";
import { TailwindResolver } from "@/components/TailwindResolver";
import { useToast } from "@/components/ui/Toast";
-import { ClipboardList, Globe, Info, Tag, Trash2 } from "lucide-react-native";
+import { shouldUseGlassPill } from "@/lib/ios";
+import useAppSettings from "@/lib/settings";
+import { shareBookmark } from "@/lib/shareBookmark";
+import { useMenuIconColors } from "@/lib/useMenuIconColors";
+import { MenuAction, MenuView } from "@react-native-menu/menu";
+import {
+ Archive,
+ ClipboardList,
+ Ellipsis,
+ Globe,
+ Info,
+ ShareIcon,
+ Star,
+ Tag,
+ Trash2,
+} from "lucide-react-native";
-import { useDeleteBookmark } from "@karakeep/shared-react/hooks/bookmarks";
+import {
+ useDeleteBookmark,
+ useUpdateBookmark,
+} from "@karakeep/shared-react/hooks/bookmarks";
import { useWhoAmI } from "@karakeep/shared-react/hooks/users";
import { BookmarkTypes, ZBookmark } from "@karakeep/shared/types/bookmarks";
-interface BottomActionsProps {
- bookmark: ZBookmark;
+function triggerHaptic() {
+ Haptics.selectionAsync().catch(() => {
+ // Ignore — haptics unavailable (e.g. simulator)
+ });
}
-export default function BottomActions({ bookmark }: BottomActionsProps) {
+interface ToolbarActionMeta {
+ label: string;
+ render: (b: ZBookmark) => string;
+ Icon: LucideIcon;
+ sfSymbol: string;
+}
+
+export const TOOLBAR_ACTION_REGISTRY: Record<
+ ToolbarActionId,
+ ToolbarActionMeta
+> = {
+ lists: {
+ label: "Lists",
+ render: () => "Lists",
+ Icon: ClipboardList,
+ sfSymbol: "list.bullet",
+ },
+ tags: { label: "Tags", render: () => "Tags", Icon: Tag, sfSymbol: "tag" },
+ info: {
+ label: "Info",
+ render: () => "Info",
+ Icon: Info,
+ sfSymbol: "info.circle",
+ },
+ favourite: {
+ label: "Favourite",
+ render: (b) => (b.favourited ? "Unfavourite" : "Favourite"),
+ Icon: Star,
+ sfSymbol: "star",
+ },
+ archive: {
+ label: "Archive",
+ render: (b) => (b.archived ? "Un-archive" : "Archive"),
+ Icon: Archive,
+ sfSymbol: "archivebox",
+ },
+ browser: {
+ label: "Open in Browser",
+ render: () => "Open in Browser",
+ Icon: Globe,
+ sfSymbol: "safari",
+ },
+ share: {
+ label: "Share",
+ render: () => "Share",
+ Icon: ShareIcon,
+ sfSymbol: "square.and.arrow.up",
+ },
+ delete: {
+ label: "Delete",
+ render: () => "Delete",
+ Icon: Trash2,
+ sfSymbol: "trash",
+ },
+};
+
+interface ToolbarAction {
+ id: ToolbarActionId;
+ icon: React.ReactNode;
+ shouldRender: boolean;
+ onClick: () => void;
+ disabled: boolean;
+}
+
+function useToolbarActions(bookmark: ZBookmark) {
const { toast } = useToast();
const router = useRouter();
+ const { settings } = useAppSettings();
const { data: currentUser } = useWhoAmI();
- // Check if the current user owns this bookmark
const isOwner = currentUser?.id === bookmark.userId;
const { mutate: deleteBookmark, isPending: isDeletionPending } =
@@ -38,6 +128,35 @@ export default function BottomActions({ bookmark }: BottomActionsProps) {
},
});
+ const { mutate: favouriteBookmark, isPending: isFavouritePending } =
+ useUpdateBookmark({
+ onError: () => {
+ toast({
+ message: "Something went wrong",
+ variant: "destructive",
+ showProgress: false,
+ });
+ },
+ });
+
+ const { mutate: archiveBookmark, isPending: isArchivePending } =
+ useUpdateBookmark({
+ onSuccess: (resp) => {
+ router.back();
+ toast({
+ message: `The bookmark has been ${resp.archived ? "archived" : "un-archived"}!`,
+ showProgress: false,
+ });
+ },
+ onError: () => {
+ toast({
+ message: "Something went wrong",
+ variant: "destructive",
+ showProgress: false,
+ });
+ },
+ });
+
const deleteBookmarkAlert = () =>
Alert.alert(
"Delete bookmark?",
@@ -52,89 +171,247 @@ export default function BottomActions({ bookmark }: BottomActionsProps) {
],
);
- const actions = [
- {
- id: "lists",
- icon: (
- <TailwindResolver
- className="text-foreground"
- comp={(styles) => <ClipboardList color={styles?.color?.toString()} />}
+ const handleShare = () => shareBookmark(bookmark, settings, toast);
+
+ const makeIcon = (
+ IconComp: LucideIcon,
+ overrideColor?: string,
+ fill?: string,
+ ) => (
+ <TailwindResolver
+ className="text-foreground"
+ comp={(styles) => (
+ <IconComp
+ size={22}
+ color={overrideColor ?? styles?.color?.toString()}
+ {...(fill != null && { fill })}
/>
- ),
+ )}
+ />
+ );
+
+ const allActions: Record<ToolbarActionId, ToolbarAction> = {
+ lists: {
+ id: "lists",
+ icon: makeIcon(ClipboardList),
shouldRender: isOwner,
onClick: () =>
router.push(`/dashboard/bookmarks/${bookmark.id}/manage_lists`),
disabled: false,
},
- {
+ tags: {
id: "tags",
- icon: (
- <TailwindResolver
- className="text-foreground"
- comp={(styles) => <Tag color={styles?.color?.toString()} />}
- />
- ),
+ icon: makeIcon(Tag),
shouldRender: isOwner,
onClick: () =>
router.push(`/dashboard/bookmarks/${bookmark.id}/manage_tags`),
disabled: false,
},
- {
- id: "open",
- icon: (
- <TailwindResolver
- className="text-foreground"
- comp={(styles) => <Info color={styles?.color?.toString()} />}
- />
- ),
+ info: {
+ id: "info",
+ icon: makeIcon(Info),
shouldRender: true,
onClick: () => router.push(`/dashboard/bookmarks/${bookmark.id}/info`),
disabled: false,
},
- {
- id: "delete",
- icon: (
- <TailwindResolver
- className="text-foreground"
- comp={(styles) => <Trash2 color={styles?.color?.toString()} />}
- />
- ),
+ favourite: {
+ id: "favourite",
+ icon: bookmark.favourited
+ ? makeIcon(Star, "#ebb434", "#ebb434")
+ : makeIcon(Star),
shouldRender: isOwner,
- onClick: deleteBookmarkAlert,
- disabled: isDeletionPending,
+ onClick: () => {
+ triggerHaptic();
+ favouriteBookmark({
+ bookmarkId: bookmark.id,
+ favourited: !bookmark.favourited,
+ });
+ },
+ disabled: isFavouritePending,
},
- {
+ archive: {
+ id: "archive",
+ icon: makeIcon(Archive),
+ shouldRender: isOwner,
+ onClick: () => {
+ archiveBookmark({
+ bookmarkId: bookmark.id,
+ archived: !bookmark.archived,
+ });
+ },
+ disabled: isArchivePending,
+ },
+ browser: {
id: "browser",
- icon: (
- <TailwindResolver
- className="text-foreground"
- comp={(styles) => <Globe color={styles?.color?.toString()} />}
- />
- ),
- shouldRender: bookmark.content.type == BookmarkTypes.LINK,
- onClick: async () => {
- if (bookmark.content.type !== BookmarkTypes.LINK) {
- return;
- }
-
- try {
- await Linking.openURL(bookmark.content.url);
- } catch {
+ icon: makeIcon(Globe),
+ shouldRender: bookmark.content.type === BookmarkTypes.LINK,
+ onClick: () => {
+ if (bookmark.content.type !== BookmarkTypes.LINK) return;
+ Linking.openURL(bookmark.content.url).catch(() => {
toast({
message: "Failed to open link",
variant: "destructive",
showProgress: false,
});
- }
+ });
+ },
+ disabled: false,
+ },
+ share: {
+ id: "share",
+ icon: makeIcon(ShareIcon),
+ shouldRender: true,
+ onClick: () => {
+ triggerHaptic();
+ handleShare();
},
disabled: false,
},
+ delete: {
+ id: "delete",
+ icon: makeIcon(Trash2),
+ shouldRender: isOwner,
+ onClick: deleteBookmarkAlert,
+ disabled: isDeletionPending,
+ },
+ };
+
+ const barActions = settings.toolbarActions
+ .map((id) => allActions[id])
+ .filter((a): a is ToolbarAction => a !== undefined);
+
+ const overflowActions = (settings.overflowActions ?? [])
+ .map((id) => allActions[id])
+ .filter((a): a is ToolbarAction => a !== undefined);
+
+ return { barActions, overflowActions, allActions };
+}
+
+function ToolbarContainer({
+ children,
+ bottomMargin,
+ bottomInset,
+}: {
+ children: React.ReactNode;
+ bottomMargin: number;
+ bottomInset: number;
+}) {
+ if (shouldUseGlassPill) {
+ return (
+ <GlassView
+ glassEffectStyle="regular"
+ style={{
+ borderRadius: 22,
+ marginHorizontal: 16,
+ marginBottom: bottomMargin,
+ paddingVertical: 10,
+ paddingHorizontal: 20,
+ flexDirection: "row",
+ alignItems: "center",
+ justifyContent: "space-between",
+ }}
+ >
+ {children}
+ </GlassView>
+ );
+ }
+
+ const fallbackStyle = {
+ flexDirection: "row" as const,
+ alignItems: "center" as const,
+ justifyContent: "space-between" as const,
+ paddingHorizontal: 40,
+ paddingTop: 16,
+ paddingBottom: bottomInset + 16,
+ };
+
+ if (Platform.OS === "ios") {
+ return (
+ <BlurView tint="systemMaterial" intensity={80} style={fallbackStyle}>
+ {children}
+ </BlurView>
+ );
+ }
+
+ return (
+ <View className="bg-background" style={fallbackStyle}>
+ {children}
+ </View>
+ );
+}
+
+interface BottomActionsProps {
+ bookmark: ZBookmark;
+}
+
+export default function BottomActions({ bookmark }: BottomActionsProps) {
+ const { barActions, overflowActions, allActions } =
+ useToolbarActions(bookmark);
+ const insets = useSafeAreaInsets();
+ const router = useRouter();
+ const { menuIconColor, destructiveMenuIconColor } = useMenuIconColors();
+
+ const bottomMargin = shouldUseGlassPill ? Math.max(insets.bottom - 8, 4) : 8;
+
+ // Build native menu actions for the overflow ellipsis
+ const menuActions: MenuAction[] = overflowActions
+ .filter((a) => a.shouldRender)
+ .map((a) => {
+ const meta = TOOLBAR_ACTION_REGISTRY[a.id];
+ return {
+ id: a.id,
+ title: meta.render(bookmark),
+ image: Platform.select({ ios: meta.sfSymbol, default: undefined }),
+ imageColor:
+ a.id === "delete" ? destructiveMenuIconColor : menuIconColor,
+ attributes: {
+ ...(a.id === "delete" && { destructive: true as const }),
+ ...(a.disabled && { disabled: true as const }),
+ },
+ };
+ });
+
+ // Add separator + "Edit Toolbar..." at the bottom
+ const menuActionsWithEdit: MenuAction[] = [
+ ...(menuActions.length > 0
+ ? [
+ {
+ id: "overflow-group",
+ // DisplayInline doesn't seem to be working on android
+ title: Platform.OS === "ios" ? "" : "More Actions",
+ displayInline: true as const,
+ subactions: menuActions,
+ },
+ ]
+ : []),
+ {
+ id: "edit-toolbar",
+ title: "Edit Toolbar...",
+ image: Platform.select({
+ ios: "slider.horizontal.3",
+ default: undefined,
+ }),
+ imageColor: menuIconColor,
+ },
];
+ const handleMenuAction = (event: string) => {
+ if (event === "edit-toolbar") {
+ router.push("/dashboard/settings/toolbar-settings");
+ return;
+ }
+ const action = allActions[event as ToolbarActionId];
+ if (action) {
+ action.onClick();
+ } else {
+ console.warn(`Unknown menu action: "${event}"`);
+ }
+ };
+
return (
<View>
- <View className="flex flex-row items-center justify-between px-10 pb-2 pt-4">
- {actions.map(
+ <ToolbarContainer bottomMargin={bottomMargin} bottomInset={insets.bottom}>
+ {barActions.map(
(a) =>
a.shouldRender && (
<Pressable
@@ -147,7 +424,24 @@ export default function BottomActions({ bookmark }: BottomActionsProps) {
</Pressable>
),
)}
- </View>
+ <MenuView
+ onPressAction={({ nativeEvent }) => {
+ triggerHaptic();
+ handleMenuAction(nativeEvent.event);
+ }}
+ actions={menuActionsWithEdit}
+ shouldOpenOnLongPress={false}
+ >
+ <Pressable onPress={() => triggerHaptic()}>
+ <TailwindResolver
+ className="text-foreground"
+ comp={(styles) => (
+ <Ellipsis size={22} color={styles?.color?.toString()} />
+ )}
+ />
+ </Pressable>
+ </MenuView>
+ </ToolbarContainer>
</View>
);
}
diff --git a/apps/mobile/lib/ios.ts b/apps/mobile/lib/ios.ts
index 4054cedd..2b390713 100644
--- a/apps/mobile/lib/ios.ts
+++ b/apps/mobile/lib/ios.ts
@@ -1,4 +1,7 @@
import { Platform } from "react-native";
+import { isGlassEffectAPIAvailable } from "expo-glass-effect";
export const isIOS26 =
Platform.OS === "ios" && parseInt(Platform.Version as string, 10) >= 26;
+
+export const shouldUseGlassPill = isIOS26 && isGlassEffectAPIAvailable();
diff --git a/apps/mobile/lib/settings.ts b/apps/mobile/lib/settings.ts
index 09073eb5..1252e5e7 100644
--- a/apps/mobile/lib/settings.ts
+++ b/apps/mobile/lib/settings.ts
@@ -7,6 +7,33 @@ import { zReaderFontFamilySchema } from "@karakeep/shared/types/users";
const SETTING_NAME = "settings";
+const zToolbarActionId = z.enum([
+ "lists",
+ "tags",
+ "info",
+ "favourite",
+ "archive",
+ "browser",
+ "share",
+ "delete",
+]);
+
+export type ToolbarActionId = z.infer<typeof zToolbarActionId>;
+
+export const DEFAULT_TOOLBAR_ACTIONS: ToolbarActionId[] = [
+ "lists",
+ "tags",
+ "info",
+ "favourite",
+ "share",
+ "browser",
+];
+
+export const DEFAULT_OVERFLOW_ACTIONS: ToolbarActionId[] = [
+ "archive",
+ "delete",
+];
+
const zSettingsSchema = z.object({
apiKey: z.string().optional(),
apiKeyId: z.string().optional(),
@@ -24,6 +51,15 @@ const zSettingsSchema = z.object({
readerFontSize: z.number().int().min(12).max(24).optional(),
readerLineHeight: z.number().min(1.2).max(2.5).optional(),
readerFontFamily: zReaderFontFamilySchema.optional(),
+ // Toolbar customization
+ toolbarActions: z
+ .array(zToolbarActionId)
+ .optional()
+ .default(DEFAULT_TOOLBAR_ACTIONS),
+ overflowActions: z
+ .array(zToolbarActionId)
+ .optional()
+ .default(DEFAULT_OVERFLOW_ACTIONS),
});
export type Settings = z.infer<typeof zSettingsSchema>;
@@ -45,6 +81,8 @@ const useSettings = create<AppSettingsState>((set, get) => ({
showNotes: false,
keepScreenOnWhileReading: false,
customHeaders: {},
+ toolbarActions: DEFAULT_TOOLBAR_ACTIONS,
+ overflowActions: DEFAULT_OVERFLOW_ACTIONS,
},
},
setSettings: async (settings) => {
@@ -71,6 +109,19 @@ const useSettings = create<AppSettingsState>((set, get) => ({
return;
}
+ // Ensure any new action IDs (added in future updates) appear in overflow
+ const knownIds = new Set([
+ ...parsed.data.toolbarActions,
+ ...parsed.data.overflowActions,
+ ]);
+ const missing = zToolbarActionId.options.filter((id) => !knownIds.has(id));
+ if (missing.length > 0) {
+ parsed.data.overflowActions = [
+ ...parsed.data.overflowActions,
+ ...missing,
+ ];
+ }
+
set((_state) => ({
settings: { isLoading: false, settings: parsed.data },
}));
diff --git a/apps/mobile/lib/shareBookmark.ts b/apps/mobile/lib/shareBookmark.ts
new file mode 100644
index 00000000..28b30292
--- /dev/null
+++ b/apps/mobile/lib/shareBookmark.ts
@@ -0,0 +1,90 @@
+import { Share } from "react-native";
+import * as Clipboard from "expo-clipboard";
+import * as FileSystem from "expo-file-system/legacy";
+import * as Sharing from "expo-sharing";
+
+import { BookmarkTypes, ZBookmark } from "@karakeep/shared/types/bookmarks";
+
+import { useToast } from "@/components/ui/Toast";
+import type { Settings } from "@/lib/settings";
+import { buildApiHeaders } from "@/lib/utils";
+
+type ToastFn = ReturnType<typeof useToast>["toast"];
+
+export async function shareBookmark(
+ bookmark: ZBookmark,
+ settings: Settings,
+ toast: ToastFn,
+) {
+ try {
+ switch (bookmark.content.type) {
+ case BookmarkTypes.LINK:
+ await Share.share({
+ url: bookmark.content.url,
+ message: bookmark.content.url,
+ });
+ break;
+
+ case BookmarkTypes.TEXT:
+ await Clipboard.setStringAsync(bookmark.content.text);
+ toast({
+ message: "Text copied to clipboard",
+ showProgress: false,
+ });
+ break;
+
+ case BookmarkTypes.ASSET: {
+ const canShare = await Sharing.isAvailableAsync();
+ const isShareable =
+ canShare &&
+ (bookmark.content.assetType === "image" ||
+ bookmark.content.assetType === "pdf");
+
+ if (!isShareable) {
+ toast({
+ message: "Sharing is not available for this file type",
+ variant: "destructive",
+ showProgress: false,
+ });
+ break;
+ }
+
+ const assetUrl = `${settings.address}/api/assets/${bookmark.content.assetId}`;
+ const fileUri =
+ bookmark.content.assetType === "pdf"
+ ? `${FileSystem.documentDirectory}${bookmark.content.fileName || "document.pdf"}`
+ : `${FileSystem.documentDirectory}temp_image.jpg`;
+ const downloadResult = await FileSystem.downloadAsync(
+ assetUrl,
+ fileUri,
+ {
+ headers: buildApiHeaders(settings.apiKey, settings.customHeaders),
+ },
+ );
+ if (downloadResult.status !== 200) {
+ throw new Error("Failed to download file");
+ }
+ try {
+ await Sharing.shareAsync(
+ downloadResult.uri,
+ bookmark.content.assetType === "pdf"
+ ? { mimeType: "application/pdf", UTI: "com.adobe.pdf" }
+ : undefined,
+ );
+ } finally {
+ await FileSystem.deleteAsync(downloadResult.uri, {
+ idempotent: true,
+ });
+ }
+ break;
+ }
+ }
+ } catch (error) {
+ console.error("Share error:", error);
+ toast({
+ message: "Failed to share",
+ variant: "destructive",
+ showProgress: false,
+ });
+ }
+}
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index 5293f661..6233b9c4 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -39,12 +39,14 @@
"clsx": "^2.1.0",
"date-fns": "^3.6.0",
"expo": "~54.0.31",
+ "expo-blur": "~55.0.8",
"expo-build-properties": "~1.0.10",
"expo-checkbox": "~5.0.8",
"expo-clipboard": "~8.0.8",
"expo-constants": "~18.0.13",
"expo-dev-client": "~6.0.20",
"expo-file-system": "~19.0.21",
+ "expo-glass-effect": "~55.0.10",
"expo-haptics": "~15.0.8",
"expo-image": "~3.0.11",
"expo-image-picker": "~17.0.10",
@@ -65,6 +67,7 @@
"react-native": "0.81.5",
"react-native-blob-util": "^0.21.2",
"react-native-css-interop": "0.2.1",
+ "react-native-draggable-flatlist": "4.0.3",
"react-native-gesture-handler": "~2.28.0",
"react-native-image-viewing": "^0.2.2",
"react-native-keyboard-controller": "^1.21.5",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1a7df300..06eb395c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -362,6 +362,9 @@ importers:
expo:
specifier: ~54.0.31
+ expo-blur:
+ specifier: ~55.0.8
expo-build-properties:
specifier: ~1.0.10
version: 1.0.10([email protected])
@@ -380,6 +383,9 @@ importers:
expo-file-system:
specifier: ~19.0.21
+ expo-glass-effect:
+ specifier: ~55.0.10
expo-haptics:
specifier: ~15.0.8
version: 15.0.8([email protected])
@@ -440,6 +446,9 @@ importers:
react-native-css-interop:
specifier: 0.2.1
+ react-native-draggable-flatlist:
+ specifier: 4.0.3
react-native-gesture-handler:
specifier: ~2.28.0
@@ -9594,6 +9603,13 @@ packages:
react: '*'
react-native: '*'
+ resolution: {integrity: sha512-NKyCKFWTNpX4CZSsiE1sgkqk/yvR1K0UTukuIbxVKoobB+yALLg1CFav0NqfdQqjhtoj5oEzP0Brlq92Z08Zfg==}
+ peerDependencies:
+ expo: '*'
+ react: '*'
+ react-native: '*'
+
resolution: {integrity: sha512-mFCZbrbrv0AP5RB151tAoRzwRJelqM7bCJzCkxpu+owOyH+p/rFC/q7H5q8B9EpVWj8etaIuszR+gKwohpmu1Q==}
peerDependencies:
@@ -9655,6 +9671,13 @@ packages:
react: '*'
react-native: '*'
+ resolution: {integrity: sha512-5kL/jATvgJWdrqPdxixrECJqD2l8cfQ4ALr1DK7qi9XkyI97ejXvUjB2VsfEePNy3Fg+/VwzA3n3L7Nv3tAPkw==}
+ peerDependencies:
+ expo: '*'
+ react: '*'
+ react-native: '*'
+
resolution: {integrity: sha512-lftutojy8Qs8zaDzzjwM3gKHFZ8bOOEZDCkmh2Ddpe95Ra6kt2izeOfOfKuP/QEh0MZ1j9TfqippyHdRd1ZM9g==}
peerDependencies:
@@ -10257,7 +10280,7 @@ packages:
resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
- deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]
+ deprecated: Glob versions prior to v9 are no longer supported
resolution: {integrity: sha512-NknMLn7F2J7aflwFOlGdNIuCDpN3VGoSoB+aap3KABFWbHVn1TCgFC+np23J8W2BiZbjfEw3BFBycSMv1AFblg==}
@@ -14159,6 +14182,13 @@ packages:
react-native-svg:
optional: true
+ resolution: {integrity: sha512-2F4x5BFieWdGq9SetD2nSAR7s7oQCSgNllYgERRXXtNfSOuAGAVbDb/3H3lP0y5f7rEyNwabKorZAD/SyyNbDw==}
+ peerDependencies:
+ react-native: '>=0.64.0'
+ react-native-gesture-handler: '>=2.0.0'
+ react-native-reanimated: '>=2.8.0'
+
resolution: {integrity: sha512-Wl3Vq2DQzxgsWKuW4USfck9zS7YzhvLNPpkwUUCF90bL32e1a0zOVQ3WsJILJOwzmPdHfzZmWasiiAUNBkhNkg==}
@@ -27146,6 +27176,12 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ dependencies:
+ react: 19.2.3
+ react-native: 0.81.5(@babel/[email protected])(@types/[email protected])([email protected])
+
dependencies:
ajv: 8.18.0
@@ -27215,6 +27251,12 @@ snapshots:
react: 19.2.3
react-native: 0.81.5(@babel/[email protected])(@types/[email protected])([email protected])
+ dependencies:
+ react: 19.2.3
+ react-native: 0.81.5(@babel/[email protected])(@types/[email protected])([email protected])
+
dependencies:
@@ -32845,6 +32887,16 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ dependencies:
+ '@babel/preset-typescript': 7.27.1(@babel/[email protected])
+ react-native: 0.81.5(@babel/[email protected])(@types/[email protected])([email protected])
+ react-native-gesture-handler: 2.28.0([email protected](@babel/[email protected])(@types/[email protected])([email protected]))([email protected])
+ transitivePeerDependencies:
+ - '@babel/core'
+ - supports-color
+
dependencies:
prop-types: 15.8.1