feat: add dialog when turning on pc

This commit is contained in:
2024-03-16 13:21:12 +07:00
parent 4dfa1decfe
commit 9eaf90ee2f
7 changed files with 84 additions and 1 deletions
+42
View File
@@ -0,0 +1,42 @@
import React from "react";
import Modal from "react-native-modal";
import Container from "./Container";
import Text from "./Text";
import { HStack } from "./Stack";
import Button from "./Button";
import { useStore } from "zustand";
import { dialogStore } from "@/stores/dialogStore";
const Dialog = () => {
const { isVisible, title, message, onConfirm, close } = useStore(dialogStore);
return (
<Modal
isVisible={isVisible}
onBackdropPress={close}
onBackButtonPress={close}
animationIn="fadeInDown"
>
<Container className="bg-white rounded-lg p-6 md:p-8">
<Text className="text-2xl font-medium">{title}</Text>
<Text className="mt-3">{message}</Text>
<HStack className="justify-end gap-4 mt-6">
<Button variant="ghost" onPress={close}>
Cancel
</Button>
<Button
onPress={() => {
onConfirm();
close();
}}
>
Confirm
</Button>
</HStack>
</Container>
</Modal>
);
};
export default React.memo(Dialog);