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

Loading…
Cancel
Save