Popup null is not an object (evaluating 'e.replace') if tap on
status -> username -> status in drawer
This commit is contained in:
Eric Dvorsak 2017-08-20 16:12:58 +02:00 committed by Roman Volosovskyi
parent bab4e33ec2
commit 92f3f9a4c5
1 changed files with 5 additions and 3 deletions

View File

@ -44,16 +44,18 @@
(defview name-input [] (defview name-input []
[account [:get-current-account] [account [:get-current-account]
name-text (r/atom nil)] name-text (r/atom nil)]
(let [previous-name (:name account)] (let [previous-name (:name account)
public-key (:public-key account)
placeholder (gfycat/generate-gfy public-key)]
[view st/name-input-wrapper [view st/name-input-wrapper
[text-input [text-input
{:placeholder (gfycat/generate-gfy public-key) {:placeholder placeholder
:style (st/name-input-text (s/valid? ::profile.db/name @name-text)) :style (st/name-input-text (s/valid? ::profile.db/name @name-text))
:font :medium :font :medium
:default-value (or @name-text previous-name) :default-value (or @name-text previous-name)
:on-change-text #(reset! name-text %) :on-change-text #(reset! name-text %)
:on-end-editing #(if (s/valid? ::profile.db/name @name-text) :on-end-editing #(if (s/valid? ::profile.db/name @name-text)
(rf/dispatch [:account-update {:name (utils/clean-text @name-text)}]) (rf/dispatch [:account-update {:name (utils/clean-text (or @name-text placeholder))}])
(reset! name-text previous-name))}]])) (reset! name-text previous-name))}]]))
(defview status-input [] (defview status-input []