Blue hashtags & new line fix (#491)
This commit is contained in:
parent
d25ac5e0fe
commit
3122cb7ac3
|
@ -22,7 +22,8 @@
|
||||||
[status-im.components.react :refer [dismiss-keyboard!]]
|
[status-im.components.react :refer [dismiss-keyboard!]]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[cljs.spec :as s]
|
[cljs.spec :as s]
|
||||||
[status-im.components.chat-icon.screen :as ci]))
|
[status-im.components.chat-icon.screen :as ci]
|
||||||
|
[taoensso.timbre :as log]))
|
||||||
|
|
||||||
(defonce drawer-atom (atom))
|
(defonce drawer-atom (atom))
|
||||||
|
|
||||||
|
@ -41,16 +42,24 @@
|
||||||
:font :default}
|
:font :default}
|
||||||
name]])
|
name]])
|
||||||
|
|
||||||
|
(defn- update-status [new-status]
|
||||||
|
(when-not (str/blank? new-status)
|
||||||
|
(dispatch [:check-status-change new-status])
|
||||||
|
(dispatch [:account-update {:status new-status}])
|
||||||
|
(dispatch [:set-in [:profile-edit :status] new-status])))
|
||||||
|
|
||||||
(defn drawer-menu []
|
(defn drawer-menu []
|
||||||
(let
|
(let
|
||||||
[account (subscribe [:get-current-account])
|
[account (subscribe [:get-current-account])
|
||||||
profile (subscribe [:get :profile-edit])
|
profile (subscribe [:get :profile-edit])
|
||||||
keyboard-height (subscribe [:get :keyboard-height])
|
keyboard-height (subscribe [:get :keyboard-height])
|
||||||
placeholder (generate-gfy)
|
placeholder (generate-gfy)
|
||||||
status-edit? (r/atom false)]
|
status-edit? (r/atom false)
|
||||||
|
status-text (r/atom nil)]
|
||||||
(fn []
|
(fn []
|
||||||
(let [{:keys [name photo-path status]} @account
|
(let [{:keys [name photo-path status]} @account
|
||||||
{new-name :name new-status :status} @profile]
|
{new-name :name
|
||||||
|
new-status :status} @profile]
|
||||||
[view st/drawer-menu
|
[view st/drawer-menu
|
||||||
[touchable-without-feedback {:on-press #(dismiss-keyboard!)}
|
[touchable-without-feedback {:on-press #(dismiss-keyboard!)}
|
||||||
[view st/drawer-menu
|
[view st/drawer-menu
|
||||||
|
@ -75,19 +84,21 @@
|
||||||
:editable true
|
:editable true
|
||||||
:multiline true
|
:multiline true
|
||||||
:auto-focus true
|
:auto-focus true
|
||||||
:blur-on-submit true
|
|
||||||
:focus status-edit?
|
:focus status-edit?
|
||||||
:maxLength 140
|
:max-length 140
|
||||||
:accessibility-label :input
|
:accessibility-label :input
|
||||||
:placeholder (label :t/profile-no-status)
|
:placeholder (label :t/profile-no-status)
|
||||||
:on-change-text (fn [t]
|
:default-value status
|
||||||
(dispatch [:set-in [:profile-edit :status] (clean-text t)]))
|
:on-blur #(do
|
||||||
:on-submit-editing (fn []
|
|
||||||
(reset! status-edit? false)
|
(reset! status-edit? false)
|
||||||
(when (and new-status (not (str/blank? new-status)))
|
(update-status @status-text))
|
||||||
(dispatch [:check-status-change (clean-text new-status)])
|
:on-change-text #(let [status (clean-text %)]
|
||||||
(dispatch [:account-update {:status (clean-text new-status)}])))
|
(reset! status-text status)
|
||||||
:default-value status}]
|
(if (str/includes? % "\n")
|
||||||
|
(do
|
||||||
|
(reset! status-edit? false)
|
||||||
|
(update-status status))
|
||||||
|
(dispatch [:set-in [:profile-edit :status] status])))}]
|
||||||
[status-view {:style st/status-text
|
[status-view {:style st/status-text
|
||||||
:on-press #(reset! status-edit? true)
|
:on-press #(reset! status-edit? true)
|
||||||
:number-of-lines 3
|
:number-of-lines 3
|
||||||
|
|
|
@ -32,8 +32,7 @@
|
||||||
[status-im.utils.random :refer [id]]
|
[status-im.utils.random :refer [id]]
|
||||||
[status-im.utils.utils :refer [clean-text]]
|
[status-im.utils.utils :refer [clean-text]]
|
||||||
[status-im.components.image-button.view :refer [show-qr-button]]
|
[status-im.components.image-button.view :refer [show-qr-button]]
|
||||||
[status-im.i18n :refer [label]]
|
[status-im.i18n :refer [label]]))
|
||||||
[taoensso.timbre :as log]))
|
|
||||||
|
|
||||||
(defn share [text dialog-title]
|
(defn share [text dialog-title]
|
||||||
(let [list-selection-fn (:list-selection-fn platform-specific)]
|
(let [list-selection-fn (:list-selection-fn platform-specific)]
|
||||||
|
@ -102,15 +101,14 @@
|
||||||
:style (st/status-input (:height (r/state component)))
|
:style (st/status-input (:height (r/state component)))
|
||||||
:multiline true
|
:multiline true
|
||||||
:editable true
|
:editable true
|
||||||
:blur-on-submit true
|
|
||||||
:on-content-size-change #(do (set-status-height %)
|
:on-content-size-change #(do (set-status-height %)
|
||||||
(reset! just-opened? false))
|
(reset! just-opened? false))
|
||||||
:max-length 140
|
:max-length 140
|
||||||
:placeholder (label :t/profile-no-status)
|
:placeholder (label :t/profile-no-status)
|
||||||
:on-change-text (fn [t]
|
:on-change-text #(let [status (clean-text %)]
|
||||||
(dispatch [:set-in [:profile-edit :status] (clean-text t)]))
|
(if (str/includes? % "\n")
|
||||||
:on-submit-editing (fn []
|
(.blur @input-ref)
|
||||||
(.blur @input-ref))
|
(dispatch [:set-in [:profile-edit :status] status])))
|
||||||
:default-value status}]
|
:default-value status}]
|
||||||
[status-view {:style (st/status-text (:height (r/state component)))
|
[status-view {:style (st/status-text (:height (r/state component)))
|
||||||
:status status}])])})))
|
:status status}])])})))
|
||||||
|
|
Loading…
Reference in New Issue