From 140554021e83ca375845584f8d7e5e476434f1c0 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Mon, 26 Aug 2024 18:00:00 +0300 Subject: feature(mobile): Add ability to create basic lists from the app --- apps/mobile/components/lists/NewListModal.tsx | 80 +++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 apps/mobile/components/lists/NewListModal.tsx (limited to 'apps/mobile/components') diff --git a/apps/mobile/components/lists/NewListModal.tsx b/apps/mobile/components/lists/NewListModal.tsx new file mode 100644 index 00000000..d31ac362 --- /dev/null +++ b/apps/mobile/components/lists/NewListModal.tsx @@ -0,0 +1,80 @@ +import React, { useState } from "react"; +import { Text, View } from "react-native"; +import { + BottomSheetBackdrop, + BottomSheetModal, + BottomSheetModalProps, + BottomSheetView, + useBottomSheetModal, +} from "@gorhom/bottom-sheet"; + +import { useCreateBookmarkList } from "@hoarder/shared-react/hooks/lists"; + +import { Button } from "../ui/Button"; +import { Input } from "../ui/Input"; +import PageTitle from "../ui/PageTitle"; +import { useToast } from "../ui/Toast"; + +const NewListModal = React.forwardRef< + BottomSheetModal, + Omit +>(({ ...props }, ref) => { + const { dismiss } = useBottomSheetModal(); + const { toast } = useToast(); + const [text, setText] = useState(""); + + const { mutate, isPending } = useCreateBookmarkList({ + onSuccess: () => { + dismiss(); + }, + onError: () => { + toast({ + message: "Something went wrong", + variant: "destructive", + }); + }, + }); + + const onSubmit = () => { + mutate({ + name: text, + icon: "🚀", + }); + }; + + return ( + + setText("")} + backdropComponent={(props) => ( + + )} + {...props} + > + + + + 🚀 + + +