transporter-app/components/modal.js

37 lines
1.6 KiB
JavaScript
Raw Permalink Normal View History

2024-06-26 23:24:26 +03:00
import {Modal, Pressable, Text, View} from "react-native";
import {BlurView} from "expo-blur";
import Button from "./button";
const ModalView = ({children, text, isVisible, setIsVisible}) => {
return (
<Modal transparent={true} visible={isVisible}>
<BlurView style={{height: "100%", width: "100%", display: "flex", justifyContent: "center", alignItems: "center"}} intensity={5}>
<View style={{backgroundColor: "#fefefe", width: "75%", borderRadius: 20, padding: 20, display: "flex"}}>
{/*Header*/}
<View>
<Text style={{fontWeight: "bold", fontSize: 20, marginBottom: 30}}>{text}</Text>
</View>
{children}
<Pressable onPress={() => setIsVisible(false)}>
<View style={{borderStyle: "solid", borderTopWidth: 1, borderTopColor: "rgba(0,0,0,0.2)", display: "flex", justifyContent: "center", alignItems: "center", paddingTop: 10}}>
<Text style={{color: "#E5352D", fontWeight: "bold", fontSize: 16}}>Отмена</Text>
</View>
</Pressable>
</View>
</BlurView>
</Modal>
)
}
export const ModalButtonSuccess = ({text, onPress}) => (
<Button color={"#64B668"} text={text} style={{paddingTop: 10, paddingBottom: 10}} onPress={onPress}/>
)
export const ModalButtonError = ({text, onPress}) => (
<Button text={text} style={{paddingTop: 10, paddingBottom: 10}} onPress={onPress}/>
)
export default ModalView