[FIX #4038] All symbols after dot/comma erased if editing decimal number in the transaction amount field

This commit is contained in:
Daniel Regeci 2018-05-06 19:11:57 +07:00 committed by Roman Volosovskyi
parent 0347a32d03
commit 0ed067af6a
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
2 changed files with 8 additions and 4 deletions

View File

@ -28,7 +28,8 @@
;; TODO(jeluard) both send and request flows should be merged
(views/letsubs [{:keys [to to-name whisper-identity]} [:wallet.send/transaction]
{:keys [amount amount-error]} [:wallet.request/transaction]
scroll (atom nil)]
scroll (atom nil)
amount-text-value (atom nil)]
[comp/simple-screen {:avoid-keyboard? true}
[comp/toolbar (i18n/label :t/new-request)]
[react/view components.styles/flex
@ -45,7 +46,8 @@
:input-options {:default-value (str (money/to-fixed (money/wei->ether amount)))
:max-length 21
:on-focus (fn [] (when @scroll (utils/set-timeout #(.scrollToEnd @scroll) 100)))
:on-change-text #(re-frame/dispatch [:wallet.request/set-and-validate-amount %])}}]]]
:on-change-text #(reset! amount-text-value %)
:on-end-editing #(re-frame/dispatch [:wallet.request/set-and-validate-amount @amount-text-value])}}]]]
[bottom-buttons/bottom-buttons styles/bottom-buttons
nil ;; Force a phantom button to ensure consistency with other transaction screens which define 2 buttons
[button/button {:disabled? (not (and to amount))

View File

@ -195,7 +195,8 @@
[advanced-cartouche transaction modal?])])
(defn- send-transaction-panel [{:keys [modal? transaction scroll advanced? symbol]}]
(let [{:keys [amount amount-error signing? to to-name sufficient-funds? in-progress? from-chat?]} transaction]
(let [{:keys [amount amount-error signing? to to-name sufficient-funds? in-progress? from-chat?]} transaction
amount-text-value (atom nil)]
[wallet.components/simple-screen {:avoid-keyboard? (not modal?)
:status-bar-type (if modal? :modal-wallet :wallet)}
[toolbar from-chat? (if modal? act/close-white act/back-white)
@ -220,7 +221,8 @@
:input-options {:default-value (str (money/to-fixed (money/wei->ether amount)))
:max-length 21
:on-focus (fn [] (when (and scroll @scroll) (utils/set-timeout #(.scrollToEnd @scroll) 100)))
:on-change-text #(re-frame/dispatch [:wallet.send/set-and-validate-amount %])}}]
:on-change-text #(reset! amount-text-value %)
:on-end-editing #(re-frame/dispatch [:wallet.send/set-and-validate-amount @amount-text-value])}}]
[advanced-options advanced? transaction modal?]]]
(if signing?
[signing-buttons