Fix #774 - Profile and drawer input inconsistencies

This commit is contained in:
Gustavo Nunes 2017-02-08 22:58:58 -02:00 committed by Roman Volosovskyi
parent 289a43ace8
commit 8957e00592
4 changed files with 11 additions and 4 deletions

View File

@ -73,8 +73,10 @@
:wrapper-style st/name-input-wrapper
:value (or new-name name)
:on-change-text #(dispatch [:set-in [:profile-edit :name] %])
:on-end-editing #(when (s/valid? ::v/name new-name)
(dispatch [:account-update {:name (clean-text new-name)}]))}]]
:on-end-editing #(do
(dispatch [:set-in [:profile-edit :name] nil])
(when (s/valid? ::v/name new-name)
(dispatch [:account-update {:name (clean-text new-name)}])))}]]
[view st/status-container
(if @status-edit?
[text-input {:style st/status-input
@ -114,6 +116,7 @@
[view st/switch-users-container
[touchable-opacity {:onPress (fn []
(close-drawer)
(dispatch [:set-in [:profile-edit :name] nil])
(dispatch [:navigate-to :accounts]))}
[text {:style st/switch-users-text
:font :default}

View File

@ -95,6 +95,7 @@
(defn reagent-render [_ _]
(let [component (r/current-component)
input-ref (r/atom nil)
{:keys [float-label?
label-top
label-font-size
@ -112,7 +113,8 @@
[view (merge st/text-field-container wrapper-style)
(when-not label-hidden?
[animated-text {:style (st/label label-top label-font-size label-color)} label])
[text-input {:style (merge st/text-input input-style)
[text-input {:ref #(reset! input-ref %)
:style (merge st/text-input input-style)
:placeholder (or placeholder "")
:editable editable
:secure-text-entry secure-text-entry
@ -138,6 +140,7 @@
(on-change-text text))
:on-change #(on-change %)
:default-value value
:on-submit-editing #(.blur @input-ref)
:on-end-editing (when on-end-editing
on-end-editing)}]
[view {:style (st/underline-container line-color)

View File

@ -191,6 +191,7 @@
qr [:get-in [:profile-edit :qr-code]]
current-account [:get-current-account]
changed-account [:get :profile-edit]]
{:component-will-unmount #(dispatch [:set-in [:profile-edit :name] nil])}
(let [{:keys [phone
address
public-key]

View File

@ -6,7 +6,7 @@
[status-im.utils.homoglyph :as h]))
(defn correct-name? [username]
(let [username (some-> username (str/trim))]
(when-let [username (some-> username (str/trim))]
(every? false?
[(str/blank? username)
(h/matches username console-chat-id)