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