This commit is contained in:
Marcos Rodriguez Velez 2025-02-19 09:20:27 -04:00
parent 8719ded414
commit 2f3ac6e972
2 changed files with 15 additions and 2 deletions

View file

@ -137,6 +137,8 @@
"details_add_rec_rem_all": "Remove All Recipients",
"details_recipients_title": "Recipients",
"details_recipient_title": "Recipient #{number} of #{total}",
"please_complete_recipient_title": "Incomplete Recipient",
"please_complete_recipient_details": "Please complete the details of recipient #{number} before adding a new recipient.",
"details_address": "Address",
"details_address_field_is_not_valid": "The address is not valid.",
"details_adv_fee_bump": "Allow Fee Bump",

View file

@ -921,11 +921,22 @@ const SendDetails = () => {
};
const handleAddRecipient = () => {
// Check if any recipient is incomplete (missing address or amount)
const incompleteIndex = addresses.findIndex(item => !item.address || !item.amount);
if (incompleteIndex !== -1) {
scrollIndex.current = incompleteIndex;
scrollView.current?.scrollToIndex({ index: incompleteIndex, animated: true });
presentAlert({
title: loc.send.please_complete_recipient_title,
message: loc.formatString(loc.send.please_complete_recipient_details, { number: incompleteIndex + 1 }),
});
return;
}
// Add new recipient as usual if all recipients are complete
setAddresses(prevAddresses => [...prevAddresses, { address: '', key: String(Math.random()) } as IPaymentDestinations]);
// Wait for the state to update before scrolling
setTimeout(() => {
scrollIndex.current = addresses.length; // New index is at the end of the list
scrollIndex.current = addresses.length; // New index at the end
scrollView.current?.scrollToIndex({
index: scrollIndex.current,
animated: true,