tiefen_space_app/components/MyModal/index.jsx

74 lines
1.9 KiB
React
Raw Normal View History

2023-12-29 00:27:44 +08:00
import { View, Text, TouchableOpacity, Modal } from "react-native";
import React from "react";
import { useTailwind } from "tailwind-rn";
export default function MyModal({
visible,
setVisible,
title,
content,
confirm,
}) {
const tailwind = useTailwind();
return (
<Modal
visible={visible}
statusBarTranslucent
transparent={true}
style={tailwind("flex-1")}
>
<View
style={{
2024-01-18 17:22:44 +08:00
backgroundColor: "#00000080",
2023-12-29 00:27:44 +08:00
...tailwind("flex-1 items-center justify-center"),
}}
>
2024-01-18 17:22:44 +08:00
<View
style={tailwind("p-2 rounded-2xl bg-[#1E1C29] items-center w-3/4")}
>
<Text
style={tailwind(
"text-white text-xl font-semibold text-center mt-2"
)}
>
2023-12-29 00:27:44 +08:00
{title}
</Text>
2024-01-18 17:22:44 +08:00
<Text
style={tailwind("text-[#FFFFFF80] text-sm font-medium mt-2 mb-4")}
>
2023-12-29 00:27:44 +08:00
{content}
</Text>
<View style={tailwind("flex-row justify-around")}>
<TouchableOpacity
onPress={() => setVisible(false)}
style={tailwind(
2024-01-18 17:22:44 +08:00
"border-r-2 border-t-2 border-[#2c2b2f] basis-1/2 pt-1 justify-center items-center"
2023-12-29 00:27:44 +08:00
)}
>
2024-01-18 17:22:44 +08:00
<Text
style={tailwind(
"text-[#FFFFFF80] text-base font-medium text-center"
)}
>
取消
</Text>
2023-12-29 00:27:44 +08:00
</TouchableOpacity>
<TouchableOpacity
onPress={confirm}
style={tailwind(
2024-01-18 17:22:44 +08:00
"border-t-2 border-[#2c2b2f] basis-1/2 pt-1 justify-center items-center"
2023-12-29 00:27:44 +08:00
)}
>
2024-01-18 17:22:44 +08:00
<Text
style={tailwind("text-white text-base font-medium text-center")}
>
确认
</Text>
2023-12-29 00:27:44 +08:00
</TouchableOpacity>
</View>
</View>
</View>
</Modal>
);
}