fix: inability to input data while routes are loading (#20298)

fix: inability to input data while routes are loading (#20298)
This commit is contained in:
Omar Basem 2024-06-11 08:05:47 +04:00 committed by GitHub
parent 3634edab42
commit 0d2869bfe0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 10 deletions

View File

@ -376,18 +376,17 @@
max-decimals (if crypto-currency? crypto-decimals 2) max-decimals (if crypto-currency? crypto-decimals 2)
regex-pattern (str "^\\d*\\.?\\d{0," max-decimals "}$") regex-pattern (str "^\\d*\\.?\\d{0," max-decimals "}$")
regex (re-pattern regex-pattern)] regex (re-pattern regex-pattern)]
(when (and (not loading-routes?) (when (re-matches regex new-text)
(re-matches regex new-text))
(debounce/clear-all) (debounce/clear-all)
(set-just-toggled-mode? false) (set-just-toggled-mode? false)
(set-input-state #(controlled-input/add-character % c))))) (set-input-state #(controlled-input/add-character % c)))))
:on-delete (fn [] :on-delete (fn []
(when-not loading-routes? (debounce/clear-all)
(debounce/clear-all) (set-just-toggled-mode? false)
(set-just-toggled-mode? false) (set-input-state controlled-input/delete-last)
(set-input-state controlled-input/delete-last))) (rf/dispatch [:wallet/clean-suggested-routes]))
:on-long-press-delete (fn [] :on-long-press-delete (fn []
(when-not loading-routes? (debounce/clear-all)
(debounce/clear-all) (set-just-toggled-mode? false)
(set-just-toggled-mode? false) (set-input-state controlled-input/delete-all)
(set-input-state controlled-input/delete-all)))}]])) (rf/dispatch [:wallet/clean-suggested-routes]))}]]))