Skip to content

Commit

Permalink
fix(wallet)_: token max value not updated when switching
Browse files Browse the repository at this point in the history
Signed-off-by: Mohamed Javid <[email protected]>
  • Loading branch information
smohamedjavid committed Sep 12, 2024
1 parent dc12a0f commit c0e0c67
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/status_im/contexts/wallet/send/input_amount/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,7 @@
utils/token-usd-price
utils/one-cent-value
utils/calc-max-crypto-decimals)
[input-state set-input-state] (rn/use-state
(-> controlled-input/init-state
(controlled-input/set-upper-limit
(utils/cut-crypto-decimals-to-fit-usd-cents
(or default-limit-crypto token-balance)
conversion-rate))))
[input-state set-input-state] (rn/use-state controlled-input/init-state)
clear-input! #(set-input-state controlled-input/delete-all)
currency-symbol (rf/sub [:profile/currency-symbol])
loading-routes? (rf/sub
Expand Down Expand Up @@ -291,6 +286,15 @@
app-keyboard-listener (.addEventListener rn/app-state "change" dismiss-keyboard-fn)]
#(.remove app-keyboard-listener))))
(hot-reload/use-safe-unmount on-navigate-back)
(rn/use-effect
(fn []
(set-input-state
#(-> %
(controlled-input/set-upper-limit
(utils/cut-crypto-decimals-to-fit-usd-cents
(or default-limit-crypto token-balance)
conversion-rate)))))
[token-symbol])
(rn/use-effect
(fn []
(when input-error (debounce/clear-all))
Expand Down

0 comments on commit c0e0c67

Please sign in to comment.