Browse Source

Confirmation modal now displays buttons only if onConfirm/onDecline

functions are passed
master
GabrielTrettel 3 years ago
parent
commit
e801c173cd
  1. 16
      src/app/components/ConfirmationModal.js

16
src/app/components/ConfirmationModal.js

@ -22,12 +22,12 @@ function Btn({ label, onPress, bgColor, txtColor }) {
export default function ConfirmationModal({ export default function ConfirmationModal({
show, show,
onConfirm,
onDecline,
confirmationLabel,
declineLabel,
title = "", title = "",
description = "", description = "",
confirmationLabel = "",
declineLabel = "",
onConfirm = () => {},
onDecline = () => {},
}) { }) {
return ( return (
<Modal <Modal
@ -60,18 +60,18 @@ export default function ConfirmationModal({
marginTop: 24, marginTop: 24,
}} }}
> >
<Btn
{onConfirm && confirmationLabel && <Btn
label={confirmationLabel} label={confirmationLabel}
onPress={onConfirm} onPress={onConfirm}
bgColor={colors.secondary} bgColor={colors.secondary}
txtColor={colors.white} txtColor={colors.white}
/>
<Btn
/>}
{onDecline && declineLabel && <Btn
label={declineLabel} label={declineLabel}
onPress={onDecline} onPress={onDecline}
bgColor={colors.lightGray} bgColor={colors.lightGray}
txtColor={colors.black} txtColor={colors.black}
/>
/>}
</View> </View>
</View> </View>
</View> </View>

Loading…
Cancel
Save