Update components/AddressInput.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Marcos Rodriguez Vélez 2024-10-27 16:35:29 -04:00 committed by GitHub
parent bec52e7680
commit 07eaf3a70e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -63,10 +63,15 @@ const AddressInput = ({
});
const validateAddressWithFeedback = useCallback((value: string) => {
const isValid = DeeplinkSchemaMatch.isBitcoinAddress(value) || DeeplinkSchemaMatch.isLightningInvoice(value);
const isBitcoinAddress = DeeplinkSchemaMatch.isBitcoinAddress(value);
const isLightningInvoice = DeeplinkSchemaMatch.isLightningInvoice(value);
const isValid = isBitcoinAddress || isLightningInvoice;
triggerHapticFeedback(isValid ? HapticFeedbackTypes.NotificationSuccess : HapticFeedbackTypes.NotificationError);
return isValid;
return {
isValid,
type: isBitcoinAddress ? 'bitcoin' : isLightningInvoice ? 'lightning' : 'invalid'
};
}, []);
const onBlurEditing = () => {