|
|
@ -2,10 +2,11 @@ import React from "react"; |
|
|
|
import { Modal, StyleSheet, Text, TouchableOpacity, View } from "react-native"; |
|
|
|
import colors from "../config/colors"; |
|
|
|
import { dimensions } from "../config/dimensions"; |
|
|
|
import { Ionicons } from "@expo/vector-icons"; |
|
|
|
|
|
|
|
function Btn({ label, onPress, bgColor, txtColor }) { |
|
|
|
return ( |
|
|
|
<TouchableOpacity onPress={onPress}> |
|
|
|
<TouchableOpacity style={{marginTop: 15}} onPress={onPress}> |
|
|
|
<View |
|
|
|
style={{ |
|
|
|
paddingHorizontal: 40, |
|
|
@ -14,7 +15,7 @@ function Btn({ label, onPress, bgColor, txtColor }) { |
|
|
|
borderRadius: 6, |
|
|
|
}} |
|
|
|
> |
|
|
|
<Text style={{color: txtColor, fontWeight: "bold"}}>{label}</Text> |
|
|
|
<Text style={{ color: txtColor, fontWeight: "bold" }}>{label}</Text> |
|
|
|
</View> |
|
|
|
</TouchableOpacity> |
|
|
|
); |
|
|
@ -26,8 +27,9 @@ export default function ConfirmationModal({ |
|
|
|
onDecline, |
|
|
|
confirmationLabel, |
|
|
|
declineLabel, |
|
|
|
title = "", |
|
|
|
title = null, |
|
|
|
description = "", |
|
|
|
icon = null, |
|
|
|
}) { |
|
|
|
return ( |
|
|
|
<Modal |
|
|
@ -45,33 +47,46 @@ export default function ConfirmationModal({ |
|
|
|
}} |
|
|
|
> |
|
|
|
<View style={styles.container}> |
|
|
|
<View style={{ flex: 1, marginBottom: title !== "" ? 40 : 0 }}> |
|
|
|
<Text |
|
|
|
style={[styles.text, { fontSize: dimensions.text.secondary }]} |
|
|
|
> |
|
|
|
{title} |
|
|
|
</Text> |
|
|
|
{title && ( |
|
|
|
<View style={{ flex: 1, marginBottom: title !== "" ? 40 : 0 }}> |
|
|
|
<Text |
|
|
|
style={[styles.text, { fontSize: dimensions.text.secondary }]} |
|
|
|
> |
|
|
|
{title} |
|
|
|
</Text> |
|
|
|
</View> |
|
|
|
)} |
|
|
|
<View style={{ flexDirection: "row", alignItems: "center" }}> |
|
|
|
{icon && ( |
|
|
|
<View style={{ marginRight: 5 }}> |
|
|
|
<Ionicons name={icon} size={30} color={colors.primary} /> |
|
|
|
</View> |
|
|
|
)} |
|
|
|
<Text style={styles.text}>{description}</Text> |
|
|
|
</View> |
|
|
|
<Text style={styles.text}>{description}</Text> |
|
|
|
<View |
|
|
|
style={{ |
|
|
|
flexDirection: "row", |
|
|
|
justifyContent: "space-evenly", |
|
|
|
marginTop: 24, |
|
|
|
marginTop: 24, |
|
|
|
}} |
|
|
|
> |
|
|
|
{onConfirm && confirmationLabel && <Btn |
|
|
|
label={confirmationLabel} |
|
|
|
onPress={onConfirm} |
|
|
|
bgColor={colors.secondary} |
|
|
|
txtColor={colors.white} |
|
|
|
/>} |
|
|
|
{onDecline && declineLabel && <Btn |
|
|
|
label={declineLabel} |
|
|
|
onPress={onDecline} |
|
|
|
bgColor={colors.lightGray} |
|
|
|
txtColor={colors.black} |
|
|
|
/>} |
|
|
|
{onConfirm && confirmationLabel && ( |
|
|
|
<Btn |
|
|
|
label={confirmationLabel} |
|
|
|
onPress={onConfirm} |
|
|
|
bgColor={colors.primary} |
|
|
|
txtColor={colors.white} |
|
|
|
/> |
|
|
|
)} |
|
|
|
{onDecline && declineLabel && ( |
|
|
|
<Btn |
|
|
|
label={declineLabel} |
|
|
|
onPress={onDecline} |
|
|
|
bgColor={colors.secondary} |
|
|
|
txtColor={colors.white} |
|
|
|
/> |
|
|
|
)} |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</View> |
|
|
@ -82,7 +97,7 @@ export default function ConfirmationModal({ |
|
|
|
|
|
|
|
const styles = StyleSheet.create({ |
|
|
|
container: { |
|
|
|
width: "80%", |
|
|
|
width: "85%", |
|
|
|
justifyContent: "center", |
|
|
|
alignSelf: "center", |
|
|
|
backgroundColor: colors.lightestGray, |
|
|
@ -90,7 +105,7 @@ const styles = StyleSheet.create({ |
|
|
|
borderWidth: 2, |
|
|
|
borderRadius: 12, |
|
|
|
paddingVertical: 16, |
|
|
|
paddingHorizontal: 12 |
|
|
|
paddingHorizontal: 12, |
|
|
|
}, |
|
|
|
text: { |
|
|
|
fontSize: dimensions.text.default, |
|
|
|