fix: unresponsive add watched address screen when entering a multi-chain address (#19185)

This commit is contained in:
Brian Sztamfater 2024-03-20 13:58:23 -03:00 committed by GitHub
parent 5854a473f0
commit 6363756c09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -6,6 +6,7 @@
[react-native.core :as rn] [react-native.core :as rn]
[reagent.core :as reagent] [reagent.core :as reagent]
[status-im.common.floating-button-page.view :as floating-button-page] [status-im.common.floating-button-page.view :as floating-button-page]
[status-im.constants :as constants]
[status-im.contexts.wallet.add-address-to-watch.style :as style] [status-im.contexts.wallet.add-address-to-watch.style :as style]
[status-im.contexts.wallet.common.validation :as validation] [status-im.contexts.wallet.common.validation :as validation]
[status-im.subs.wallet.add-account.address-to-watch] [status-im.subs.wallet.add-account.address-to-watch]
@ -22,6 +23,10 @@
(or (validation/eth-address? user-input) (or (validation/eth-address? user-input)
(validation/ens-name? user-input))) (i18n/label :t/invalid-address))) (validation/ens-name? user-input))) (i18n/label :t/invalid-address)))
(defn- extract-address
[scanned-text]
(re-find constants/regx-address-contains scanned-text))
(defn- address-input (defn- address-input
[{:keys [input-value validation-msg validate clear-input]}] [{:keys [input-value validation-msg validate clear-input]}]
(let [scanned-address (rf/sub [:wallet/scanned-address]) (let [scanned-address (rf/sub [:wallet/scanned-address])
@ -138,7 +143,8 @@
:on-press (fn [] :on-press (fn []
(rf/dispatch [:navigate-to (rf/dispatch [:navigate-to
:screen/wallet.confirm-address-to-watch :screen/wallet.confirm-address-to-watch
{:address validated-address}]) {:address (extract-address
validated-address)}])
(clear-input)) (clear-input))
:container-style {:z-index 2}} :container-style {:z-index 2}}
(i18n/label :t/continue)]} (i18n/label :t/continue)]}