diff --git a/loc/en.json b/loc/en.json index b73e83db8..b3fc6c5e6 100644 --- a/loc/en.json +++ b/loc/en.json @@ -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", diff --git a/screen/send/SendDetails.tsx b/screen/send/SendDetails.tsx index c12bb23c8..e1c467cb3 100644 --- a/screen/send/SendDetails.tsx +++ b/screen/send/SendDetails.tsx @@ -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,