Skip to content

Commit

Permalink
feat: Update donation amount input value handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Fishbakh-N committed Aug 5, 2024
1 parent 29f4994 commit aefdea9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const DonationAmount = () => {
inputMode="numeric"
min={0}
step={1}
value={donationAmount ? donationAmount : undefined}
value={donationAmount ? donationAmount : ''}
prefix={DEFAULT_CURRENCY.symbol}
inputClassName={donationAmountInputCss}
prefixClassName={donationAmountInputPrefixCss}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ export const WidgetContextProvider: FunctionalComponent<{hide: () => void}> = ({
const [donationAmount, setDonationAmount] = useState(
config.amount ?? config.defaultDonationAmount
);

useEffect(() => {
setDonationAmount(config.amount);
}, [config.amount]);

const [submitError, setSubmitError] = useState<string | null>(null);
const [selectedPaymentMethod, setSelectedPaymentMethod] = useState(
config.methods[0]
Expand Down

0 comments on commit aefdea9

Please sign in to comment.