Disable input field on send asset page (#20564)

This commit is contained in:
Volodymyr Kozieiev 2024-06-28 13:27:38 +01:00 committed by GitHub
parent e92da6d24b
commit 3e268936f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 44 additions and 37 deletions

View File

@ -81,8 +81,9 @@
(js->clj :keywordize-keys true) (js->clj :keywordize-keys true)
(on-selection-change))))] (on-selection-change))))]
(fn [{:keys [token customization-color show-keyboard? crypto? currency value error? selection (fn [{:keys [token customization-color show-keyboard? crypto? currency value error? selection
handle-on-swap] handle-on-swap allow-selection?]
:or {show-keyboard? true}}] :or {show-keyboard? true
allow-selection? true}}]
(let [theme (quo.theme/use-theme) (let [theme (quo.theme/use-theme)
window-width (:width (rn/get-window))] window-width (:width (rn/get-window))]
[rn/pressable [rn/pressable
@ -107,7 +108,8 @@
:selection-color customization-color :selection-color customization-color
:show-soft-input-on-focus show-keyboard? :show-soft-input-on-focus show-keyboard?
:on-selection-change handle-selection-change :on-selection-change handle-selection-change
:selection (clj->js selection)} :selection (clj->js selection)
:editable allow-selection?}
controlled-input? (assoc :value value) controlled-input? (assoc :value value)
(not controlled-input?) (assoc :default-value value-internal))] (not controlled-input?) (assoc :default-value value-internal))]
[token-name-text theme (if crypto? token currency)]]] [token-name-text theme (if crypto? token currency)]]]

View File

@ -23,6 +23,8 @@
:options [{:key :usd} :options [{:key :usd}
{:key :eur}]} {:key :eur}]}
{:key :error? {:key :error?
:type :boolean}
{:key :allow-selection?
:type :boolean}]) :type :boolean}])
(defn view (defn view
@ -33,7 +35,8 @@
:networks networks :networks networks
:title title :title title
:customization-color :blue :customization-color :blue
:show-keyboard? false}) :show-keyboard? false
:allow-selection? true})
value (reagent/atom "") value (reagent/atom "")
set-value (fn [v] set-value (fn [v]
(swap! value str v)) (swap! value str v))

View File

@ -349,23 +349,24 @@
:on-press on-navigate-back :on-press on-navigate-back
:switcher-type :select-account}] :switcher-type :select-account}]
[quo/token-input [quo/token-input
{:container-style style/input-container {:container-style style/input-container
:token token-symbol :token token-symbol
:currency fiat-currency :currency fiat-currency
:currency-symbol currency-symbol :currency-symbol currency-symbol
:crypto-decimals (min token-decimals 6) :crypto-decimals (min token-decimals 6)
:error? (controlled-input/input-error input-state) :error? (controlled-input/input-error input-state)
:networks (seq send-enabled-networks) :networks (seq send-enabled-networks)
:title (i18n/label :title (i18n/label
:t/send-limit :t/send-limit
{:limit (if crypto-currency? {:limit (if crypto-currency?
(utils/make-limit-label-crypto current-limit token-symbol) (utils/make-limit-label-crypto current-limit token-symbol)
(utils/make-limit-label-fiat current-limit currency-symbol))}) (utils/make-limit-label-fiat current-limit currency-symbol))})
:conversion conversion-rate :conversion conversion-rate
:show-keyboard? false :show-keyboard? false
:value input-amount :value input-amount
:on-swap swap-between-fiat-and-crypto :on-swap swap-between-fiat-and-crypto
:on-token-press show-select-asset-sheet}] :on-token-press show-select-asset-sheet
:allow-selection? false}]
[routes/view [routes/view
{:token token-by-symbol {:token token-by-symbol
:input-value input-amount :input-value input-amount

View File

@ -170,22 +170,23 @@
{:title (i18n/label :t/send-from-network {:network network-name-str}) {:title (i18n/label :t/send-from-network {:network network-name-str})
:description (i18n/label :t/define-amount-sent-from-network {:network network-name-str})}] :description (i18n/label :t/define-amount-sent-from-network {:network network-name-str})}]
[quo/token-input [quo/token-input
{:container-style style/input-container {:container-style style/input-container
:token token-symbol :token token-symbol
:currency fiat-currency :currency fiat-currency
:currency-symbol currency-symbol :currency-symbol currency-symbol
:crypto-decimals (min token-decimals 6) :crypto-decimals (min token-decimals 6)
:error? (controlled-input/input-error input-state) :error? (controlled-input/input-error input-state)
:networks [network-details] :networks [network-details]
:title (i18n/label :title (i18n/label
:t/send-limit :t/send-limit
{:limit (if crypto-currency? {:limit (if crypto-currency?
(utils/make-limit-label-crypto current-limit token-symbol) (utils/make-limit-label-crypto current-limit token-symbol)
(utils/make-limit-label-fiat current-limit currency-symbol))}) (utils/make-limit-label-fiat current-limit currency-symbol))})
:conversion conversion-rate :conversion conversion-rate
:show-keyboard? false :show-keyboard? false
:value (controlled-input/input-value input-state) :value (controlled-input/input-value input-state)
:on-swap swap-between-fiat-and-crypto}] :on-swap swap-between-fiat-and-crypto
:allow-selection? false}]
[quo/disclaimer [quo/disclaimer
{:on-change (fn [checked?] {:on-change (fn [checked?]
(set-is-amount-locked checked?)) (set-is-amount-locked checked?))