A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
fix(mobile): revert ios context menu
Mohamed Bassemed836e8e3047
diff --git a/apps/mobile/app.config.js b/apps/mobile/app.config.jsindex 17931a1c..2903e252 100644--- a/apps/mobile/app.config.js+++ b/apps/mobile/app.config.js@@ -12,7 +12,7 @@ export default {scheme: "karakeep",}),slug: "hoarder",- version: "1.11.0",+ version: "1.11.1",orientation: "portrait",icon: "./assets/icon.png",userInterfaceStyle: "automatic",@@ -47,7 +47,7 @@ export default {NSAllowsArbitraryLoads: true,},},- buildNumber: "45",+ buildNumber: "46",},android: {adaptiveIcon: {@@ -68,7 +68,7 @@ export default {package: IS_DEV? "app.hoarder.hoardermobile.dev": "app.hoarder.hoardermobile",- versionCode: 45,+ versionCode: 46,},plugins: ["./plugins/trust-local-certs.js",diff --git a/apps/mobile/app/dashboard/(tabs)/(lists)/index.tsx b/apps/mobile/app/dashboard/(tabs)/(lists)/index.tsxindex b4d4c320..83b3e237 100644--- a/apps/mobile/app/dashboard/(tabs)/(lists)/index.tsx+++ b/apps/mobile/app/dashboard/(tabs)/(lists)/index.tsx@@ -15,7 +15,7 @@ import { Text } from "@/components/ui/Text";import { useColorScheme } from "@/lib/useColorScheme";import { condProps } from "@/lib/utils";import { useQuery, useQueryClient } from "@tanstack/react-query";-import { Plus } from "lucide-react-native";+import { ChevronDown, Plus } from "lucide-react-native";import { useBookmarkLists } from "@karakeep/shared-react/hooks/lists";import { useTRPC } from "@karakeep/shared-react/trpc";@@ -215,14 +215,11 @@ export default function Lists() {}));}}>- <ChevronRight- color={colors.foreground}- style={{- transform: [- { rotate: l.item.collapsed ? "0deg" : "90deg" },- ],- }}- />+ {l.item.collapsed ? (+ <ChevronRight color={colors.foreground} />+ ) : (+ <ChevronDown color={colors.foreground} />+ )}</Pressable>)}</View>@@ -267,6 +264,7 @@ export default function Lists() {</View>)}data={links}+ keyExtractor={(item) => item.id}refreshing={refreshing}onRefresh={onRefresh}/>diff --git a/apps/mobile/components/bookmarks/BookmarkCard.tsx b/apps/mobile/components/bookmarks/BookmarkCard.tsxindex a600ec2c..2787f530 100644--- a/apps/mobile/components/bookmarks/BookmarkCard.tsx+++ b/apps/mobile/components/bookmarks/BookmarkCard.tsx@@ -6,7 +6,7 @@ import { useQuery } from "@tanstack/react-query";import { format, isAfter, subYears } from "date-fns";import { Image } from "expo-image";import { useRouter } from "expo-router";-import { Linking, Platform, View } from "react-native";+import { Linking, View } from "react-native";import { useTRPC } from "@karakeep/shared-react/trpc";import type { ZBookmark } from "@karakeep/shared/types/bookmarks";@@ -212,7 +212,7 @@ function CardLayout({ ctx }: { ctx: BookmarkCardContext }) {<TagList bookmark={ctx.bookmark} /><View className="flex-row justify-between border-t border-border px-2 pb-2 pt-2"><BookmarkFooterMetadata ctx={ctx} />- {Platform.OS !== "ios" && <ActionBar actions={ctx.actions} />}+ <ActionBar actions={ctx.actions} /></View></View></View>@@ -259,17 +259,15 @@ function ListLayout({ ctx }: { ctx: BookmarkCardContext }) {<View className="h-7 justify-center overflow-hidden"><TagList bookmark={ctx.bookmark} /></View>- {Platform.OS !== "ios" && (- <View- className={- hasCompactMedia- ? "mt-auto flex-row justify-end pt-0.5"- : "flex-row justify-end pt-0.5"- }- >- <ActionBar actions={ctx.actions} compact />- </View>- )}+ <View+ className={+ hasCompactMedia+ ? "mt-auto flex-row justify-end pt-0.5"+ : "flex-row justify-end pt-0.5"+ }+ >+ <ActionBar actions={ctx.actions} compact />+ </View></View></View></BookmarkCardContainer.Root>diff --git a/apps/mobile/components/bookmarks/card/BookmarkCard.tsx b/apps/mobile/components/bookmarks/card/BookmarkCard.tsxindex fd84954f..5d5bfe3a 100644--- a/apps/mobile/components/bookmarks/card/BookmarkCard.tsx+++ b/apps/mobile/components/bookmarks/card/BookmarkCard.tsx@@ -5,7 +5,6 @@ import { createContext, useContext } from "react";import { Pressable, View } from "react-native";import { NotePreview } from "../NotePreview";-import BookmarkCardContextMenu from "./bookmark-card-context-menu";import type { BookmarkActionController } from "./use-bookmark-actions";export interface BookmarkCardContext {@@ -140,8 +139,7 @@ function Title() {}function Root({ children }: { children: React.ReactNode }) {- const ctx = useContext(BookmarkCardContext);- const card = (+ return (<ViewclassName="overflow-hidden rounded-xl bg-card"style={{ borderCurve: "continuous" }}@@ -149,16 +147,6 @@ function Root({ children }: { children: React.ReactNode }) {{children}</View>);-- if (!ctx) {- return card;- }-- return (- <BookmarkCardContextMenu actions={ctx.actions}>- {card}- </BookmarkCardContextMenu>- );}const BookmarkCardContainer = {diff --git a/apps/mobile/components/bookmarks/card/bookmark-card-context-menu.ios.tsx b/apps/mobile/components/bookmarks/card/bookmark-card-context-menu.ios.tsxdeleted file mode 100644index 35f0b2ac..00000000--- a/apps/mobile/components/bookmarks/card/bookmark-card-context-menu.ios.tsx+++ /dev/null@@ -1,27 +0,0 @@-import { MenuView } from "@expo/ui/community/menu";-import type { MenuAction as ExpoMenuAction } from "@expo/ui/community/menu";--import type { BookmarkActionController } from "./use-bookmark-actions";--interface BookmarkCardContextMenuProps {- actions: BookmarkActionController;- children: React.ReactElement;-}--export default function BookmarkCardContextMenu({- actions,- children,-}: BookmarkCardContextMenuProps) {- return (- <MenuView- actions={actions.contextMenuActions as unknown as ExpoMenuAction[]}- onPressAction={({ nativeEvent }) => {- actions.handleAction(nativeEvent.event);- }}- shouldOpenOnLongPress- style={{ alignSelf: "stretch" }}- >- {children}- </MenuView>- );-}diff --git a/apps/mobile/components/bookmarks/card/bookmark-card-context-menu.tsx b/apps/mobile/components/bookmarks/card/bookmark-card-context-menu.tsxdeleted file mode 100644index 9e10d108..00000000--- a/apps/mobile/components/bookmarks/card/bookmark-card-context-menu.tsx+++ /dev/null@@ -1,12 +0,0 @@-import type { BookmarkActionController } from "./use-bookmark-actions";--interface BookmarkCardContextMenuProps {- actions: BookmarkActionController;- children: React.ReactElement;-}--export default function BookmarkCardContextMenu({- children,-}: BookmarkCardContextMenuProps) {- return children;-}diff --git a/apps/mobile/components/bookmarks/card/use-bookmark-actions.ts b/apps/mobile/components/bookmarks/card/use-bookmark-actions.tsindex 1dba1403..15a9b15d 100644--- a/apps/mobile/components/bookmarks/card/use-bookmark-actions.ts+++ b/apps/mobile/components/bookmarks/card/use-bookmark-actions.ts@@ -20,7 +20,6 @@ export interface BookmarkActionController {isBusy: boolean;isFavourited: boolean;menuActions: MenuAction[];- contextMenuActions: MenuAction[];handleAction: (actionId: string) => void;share: () => void;toggleFavourite: () => void;@@ -182,25 +181,6 @@ export function useBookmarkActions(});}- const contextMenuActions: MenuAction[] = [- ...(isOwner- ? [- {- id: "toggle-favourite",- title: isFavourited ? "Remove from Favorites" : "Add to Favorites",- image: isFavourited ? "star.slash" : "star",- state: isFavourited ? ("on" as const) : ("off" as const),- },- ]- : []),- {- id: "share",- title: "Share",- image: "square.and.arrow.up",- },- ...menuActions,- ];-const handleAction = (actionId: string) => {if (actionId === "toggle-favourite") {toggleFavourite();@@ -234,7 +214,6 @@ export function useBookmarkActions(isBusy: isArchivePending || isDeletionPending,isFavourited,menuActions,- contextMenuActions,handleAction,share,toggleFavourite,diff --git a/apps/mobile/components/ui/SearchInput/SearchInput.ios.tsx b/apps/mobile/components/ui/SearchInput/SearchInput.ios.tsxindex 2484e56c..d492e44c 100644--- a/apps/mobile/components/ui/SearchInput/SearchInput.ios.tsx+++ b/apps/mobile/components/ui/SearchInput/SearchInput.ios.tsx@@ -1,10 +1,14 @@import * as React from "react";-import { Pressable, TextInput, View, ViewStyle } from "react-native";+import {+ LayoutChangeEvent,+ Pressable,+ TextInput,+ View,+ ViewStyle,+} from "react-native";import Animated, {- measure,- useAnimatedRef,useAnimatedStyle,- useDerivedValue,+ useSharedValue,withTiming,} from "react-native-reanimated";import { TailwindResolver } from "@/components/TailwindResolver";@@ -42,11 +46,16 @@ const SearchInput = React.forwardRef<) => {const inputRef = useAugmentedRef({ ref, methods: { focus, blur, clear } });const [showCancel, setShowCancel] = React.useState(false);- const showCancelDerivedValue = useDerivedValue(- () => showCancel,- [showCancel],- );- const animatedRef = useAnimatedRef();+ const cancelButtonWidth = useSharedValue(cancelText.length * 11.2);+ const cancelButtonVisibility = useSharedValue(0);++ React.useEffect(() => {+ cancelButtonVisibility.set(withTiming(showCancel ? 1 : 0));+ }, [cancelButtonVisibility, showCancel]);++ React.useEffect(() => {+ cancelButtonWidth.set(cancelText.length * 11.2);+ }, [cancelButtonWidth, cancelText]);const [value = "", onChangeText] = useControllableState({prop: valueProp,@@ -55,54 +64,29 @@ const SearchInput = React.forwardRef<});const rootStyle = useAnimatedStyle(() => {- if (_WORKLET) {- // safely use measure- const measurement = measure(animatedRef);- return {- paddingRight: showCancelDerivedValue.value- ? withTiming(measurement?.width ?? cancelText.length * 11.2)- : withTiming(0),- };- }return {- paddingRight: showCancelDerivedValue.value- ? withTiming(cancelText.length * 11.2)- : withTiming(0),+ paddingRight: cancelButtonVisibility.get() * cancelButtonWidth.get(),};});- const buttonStyle3 = useAnimatedStyle(() => {- if (_WORKLET) {- // safely use measure- const measurement = measure(animatedRef);- return {- position: "absolute",- right: 0,- opacity: showCancelDerivedValue.value ? withTiming(1) : withTiming(0),- transform: [- {- translateX: showCancelDerivedValue.value- ? withTiming(0)- : measurement?.width- ? withTiming(measurement.width)- : cancelText.length * 11.2,- },- ],- };- }++ const buttonStyle = useAnimatedStyle(() => {+ const visibility = cancelButtonVisibility.get();return {position: "absolute",right: 0,- opacity: showCancelDerivedValue.value ? withTiming(1) : withTiming(0),+ opacity: visibility,transform: [{- translateX: showCancelDerivedValue.value- ? withTiming(0)- : withTiming(cancelText.length * 11.2),+ translateX: (1 - visibility) * cancelButtonWidth.get(),},],};});+ function onCancelButtonLayout(event: LayoutChangeEvent) {+ cancelButtonWidth.set(event.nativeEvent.layout.width);+ }+function focus() {inputRef.current?.focus();}@@ -159,8 +143,8 @@ const SearchInput = React.forwardRef</></Animated.View><Animated.View- ref={animatedRef}- style={buttonStyle3}+ onLayout={onCancelButtonLayout}+ style={buttonStyle}pointerEvents={!showCancel ? "none" : "auto"}><Pressablediff --git a/apps/mobile/package.json b/apps/mobile/package.jsonindex cb21e575..9a75e339 100644--- a/apps/mobile/package.json+++ b/apps/mobile/package.json@@ -23,7 +23,6 @@"@emoji-mart/data": "^1.1.2","@expo/dom-webview": "~56.0.6","@expo/metro-runtime": "~56.0.16",- "@expo/ui": "56.0.21","@expo/vector-icons": "^15.0.3","@karakeep/shared": "workspace:^0.1.0","@karakeep/shared-react": "workspace:^0.1.0",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 9006770b..7a27d056 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -337,9 +337,6 @@ importers:'@expo/metro-runtime':specifier: ~56.0.16version: 56.0.16(@expo/[email protected])([email protected])([email protected]([email protected]))([email protected](patch_hash=7d74c7fbd33e9f3f3f8a8ba47a013acfc098948e39c7faab1232e6edca358ac1)(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])- '@expo/ui':- specifier: 56.0.21- version: 56.0.21(@babel/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected])([email protected]([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))([email protected](patch_hash=7d74c7fbd33e9f3f3f8a8ba47a013acfc098948e39c7faab1232e6edca358ac1)(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected]))([email protected](patch_hash=7d74c7fbd33e9f3f3f8a8ba47a013acfc098948e39c7faab1232e6edca358ac1)(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])'@expo/vector-icons':specifier: ^15.0.3version: 15.0.3([email protected])([email protected](patch_hash=7d74c7fbd33e9f3f3f8a8ba47a013acfc098948e39c7faab1232e6edca358ac1)(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])