Do not prevent input if first character is invalid

This commit is contained in:
Julien Eluard 2017-06-14 23:32:54 +02:00 committed by Roman Volosovskyi
parent 2ab9e4e85e
commit 7da40ce7fa
1 changed files with 2 additions and 1 deletions

View File

@ -118,6 +118,7 @@
auto-focus on-change-text on-change on-end-editing editable placeholder auto-focus on-change-text on-change on-end-editing editable placeholder
placeholder-text-color auto-capitalize multiline number-of-lines]} placeholder-text-color auto-capitalize multiline number-of-lines]}
(merge default-props (r/props component)) (merge default-props (r/props component))
valid-value (or valid-value "")
line-color (if error error-color line-color) line-color (if error error-color line-color)
focus-line-color (if error error-color focus-line-color) focus-line-color (if error error-color focus-line-color)
label-color (if (and error (not float-label?)) error-color label-color) label-color (if (and error (not float-label?)) error-color label-color)
@ -164,7 +165,7 @@
(on-change-text text)) (on-change-text text))
(r/set-state component {:temp-value valid-value (r/set-state component {:temp-value valid-value
:max-length (count valid-value)}))) :max-length (count valid-value)})))
:on-change #(on-change %) :on-change on-change
:default-value value :default-value value
:value temp-value :value temp-value
:max-length max-length :max-length max-length