forked from cemaden-educacao/WPD-MobileApp
GabrielTrettel
3 years ago
2 changed files with 123 additions and 14 deletions
@ -0,0 +1,96 @@ |
|||
import React from "react"; |
|||
import { |
|||
Modal, |
|||
StyleSheet, |
|||
Text, |
|||
TouchableHighlight, |
|||
View, |
|||
} from "react-native"; |
|||
|
|||
import { MaterialCommunityIcons } from "@expo/vector-icons"; |
|||
import colors from "../config/colors"; |
|||
import { dimensions } from "../config/dimensions"; |
|||
import { TouchableOpacity } from "react-native-gesture-handler"; |
|||
|
|||
function Btn({ label, onPress, bgColor, txtColor }) { |
|||
return ( |
|||
<TouchableOpacity onPress={() => onPress()}> |
|||
<View |
|||
style={{ |
|||
paddingHorizontal: 30, |
|||
paddingVertical: 5, |
|||
backgroundColor: bgColor, |
|||
borderRadius: 6, |
|||
}} |
|||
> |
|||
<Text>{label}</Text> |
|||
</View> |
|||
</TouchableOpacity> |
|||
); |
|||
} |
|||
|
|||
export default function ConfirmationModal({ |
|||
show, |
|||
title = "", |
|||
description = "", |
|||
confirmationLabel = "", |
|||
declineLabel = "", |
|||
onConfirm = () => {}, |
|||
onDecline = () => {}, |
|||
}) { |
|||
console.log("show: " + show); |
|||
return ( |
|||
<Modal |
|||
transparent={true} |
|||
animationType="slide" |
|||
visible={show} |
|||
supportedOrientations={["portrait"]} |
|||
> |
|||
<View style={styles.container}> |
|||
<View style={{ flex: 1 }}> |
|||
<Text style={[styles.text, { fontSize: dimensions.text.secondary }]}> |
|||
{title} |
|||
</Text> |
|||
</View> |
|||
<Text style={styles.text}>{description}</Text> |
|||
<View |
|||
style={{ |
|||
flexDirection: "row", |
|||
justifyContent: "space-evenly", |
|||
marginTop: 24, |
|||
}} |
|||
> |
|||
<Btn |
|||
label={confirmationLabel} |
|||
onPress={onConfirm} |
|||
bgColor={colors.secondary} |
|||
/> |
|||
<Btn |
|||
label={declineLabel} |
|||
onPress={onDecline} |
|||
bgColor={colors.lightGray} |
|||
/> |
|||
</View> |
|||
</View> |
|||
</Modal> |
|||
); |
|||
} |
|||
|
|||
const styles = StyleSheet.create({ |
|||
container: { |
|||
width: "80%", |
|||
height: 150, |
|||
justifyContent: "center", |
|||
alignSelf: "center", |
|||
backgroundColor: colors.lightestGray, |
|||
borderColor: colors.primary, |
|||
borderWidth: 2, |
|||
borderRadius: 12, |
|||
padding: 12, |
|||
}, |
|||
text: { |
|||
fontSize: dimensions.text.default, |
|||
textAlign: "left", |
|||
fontWeight: "bold", |
|||
}, |
|||
}); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue