Skip to content

Commit

Permalink
ui(mobile): Change the creation buttons to be under a menu
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedBassem committed Mar 15, 2024
1 parent dc591f8 commit 77b7892
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 12 deletions.
2 changes: 1 addition & 1 deletion apps/mobile/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
52 changes: 41 additions & 11 deletions apps/mobile/app/dashboard/(tabs)/index.tsx
Original file line number Diff line number Diff line change
@@ -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>
);
}

Expand Down

0 comments on commit 77b7892

Please sign in to comment.