aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-03-15 17:41:30 +0000
committerMohamedBassem <me@mbassem.com>2024-03-15 17:41:30 +0000
commit77b78922e5d16eddbe2f2b8f97b4e8cef1d4f5b3 (patch)
treeeb52e0665b930e09b0d66178563ba3a975cafa06 /apps
parentdc591f8c28a6a3c565cd30bbb09e5e54cca68497 (diff)
downloadkarakeep-77b78922e5d16eddbe2f2b8f97b4e8cef1d4f5b3.tar.zst
ui(mobile): Change the creation buttons to be under a menu
Diffstat (limited to 'apps')
-rw-r--r--apps/mobile/app.json2
-rw-r--r--apps/mobile/app/dashboard/(tabs)/index.tsx52
2 files changed, 42 insertions, 12 deletions
diff --git a/apps/mobile/app.json b/apps/mobile/app.json
index e54d5758..f2a34cd0 100644
--- a/apps/mobile/app.json
+++ b/apps/mobile/app.json
@@ -3,7 +3,7 @@
"name": "Hoarder App",
"slug": "hoarder",
"scheme": "hoarder",
- "version": "1.2.1",
+ "version": "1.2.2",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
diff --git a/apps/mobile/app/dashboard/(tabs)/index.tsx b/apps/mobile/app/dashboard/(tabs)/index.tsx
index fe15956c..1736def9 100644
--- a/apps/mobile/app/dashboard/(tabs)/index.tsx
+++ b/apps/mobile/app/dashboard/(tabs)/index.tsx
@@ -1,18 +1,48 @@
-import { View } from "react-native";
-import { Link, Stack } from "expo-router";
+import { Platform, View } from "react-native";
+import * as Haptics from "expo-haptics";
+import { Stack, useRouter } from "expo-router";
import BookmarkList from "@/components/bookmarks/BookmarkList";
-import { Link as LinkIcon, SquarePen } from "lucide-react-native";
+import { MenuView } from "@react-native-menu/menu";
+import { SquarePen } from "lucide-react-native";
function HeaderRight() {
+ const router = useRouter();
return (
- <View className="flex flex-row">
- <Link href="dashboard/add-link" className="mt-2 px-2">
- <LinkIcon />
- </Link>
- <Link href="dashboard/add-note" className="mt-2 px-2">
- <SquarePen />
- </Link>
- </View>
+ <MenuView
+ onPressAction={({ nativeEvent }) => {
+ Haptics.selectionAsync();
+ if (nativeEvent.event === "note") {
+ router.navigate("dashboard/add-note");
+ } else if (nativeEvent.event === "link") {
+ router.navigate("dashboard/add-link");
+ }
+ }}
+ actions={[
+ {
+ id: "link",
+ title: "New Link",
+ image: Platform.select({
+ ios: "link",
+ android: "ic_menu_link",
+ }),
+ },
+ {
+ id: "note",
+ title: "New Note",
+ image: Platform.select({
+ ios: "note",
+ android: "ic_menu_note",
+ }),
+ },
+ ]}
+ shouldOpenOnLongPress={false}
+ >
+ <View className="mt-2 px-2">
+ <SquarePen
+ onPress={() => Haptics.selectionAsync()}
+ />
+ </View>
+ </MenuView>
);
}