selectin color changed for selectable text inputs and texts (#5469)

This commit is contained in:
Volodymyr Kozieiev 2018-08-14 15:45:37 +03:00 committed by GitHub
parent 879e33b9b5
commit 6cdb1ac629
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 25 deletions

View File

@ -10,7 +10,8 @@
[status-im.ui.screens.add-new.new-public-chat.view :refer [default-public-chats]] [status-im.ui.screens.add-new.new-public-chat.view :refer [default-public-chats]]
[status-im.ui.screens.add-new.new-public-chat.db :as public-chat-db] [status-im.ui.screens.add-new.new-public-chat.db :as public-chat-db]
[taoensso.timbre :as log] [taoensso.timbre :as log]
[status-im.ui.components.react :as react])) [status-im.ui.components.react :as react]
[status-im.ui.components.colors :as colors]))
(views/defview new-contact [] (views/defview new-contact []
(views/letsubs [new-contact-identity [:get :contacts/new-identity] (views/letsubs [new-contact-identity [:get :contacts/new-identity]
@ -29,13 +30,14 @@
[react/text {:style styles/new-contact-subtitle} (i18n/label :contact-code)] [react/text {:style styles/new-contact-subtitle} (i18n/label :contact-code)]
[react/view {:style styles/new-contact-separator}] [react/view {:style styles/new-contact-separator}]
[react/view {:style styles/add-contact-edit-view} [react/view {:style styles/add-contact-edit-view}
[react/text-input {:placeholder "0x..." [react/text-input {:placeholder "0x..."
:flex 1 :flex 1
:style styles/add-contact-input :style styles/add-contact-input
:on-change (fn [e] :selection-color colors/hawkes-blue
(let [native-event (.-nativeEvent e) :on-change (fn [e]
text (.-text native-event)] (let [native-event (.-nativeEvent e)
(re-frame/dispatch [:set :contacts/new-identity text])))}] text (.-text native-event)]
(re-frame/dispatch [:set :contacts/new-identity text])))}]
[react/touchable-highlight {:disabled chat-error :on-press #(when-not chat-error (re-frame/dispatch [:add-contact-handler new-contact-identity]))} [react/touchable-highlight {:disabled chat-error :on-press #(when-not chat-error (re-frame/dispatch [:add-contact-handler new-contact-identity]))}
[react/view [react/view
{:style (styles/add-contact-button chat-error)} {:style (styles/add-contact-button chat-error)}
@ -64,17 +66,18 @@
[react/view {:style styles/new-contact-separator}] [react/view {:style styles/new-contact-separator}]
[react/view {:style styles/add-contact-edit-view} [react/view {:style styles/add-contact-edit-view}
[react/view {:style {:flex 1}} [react/view {:style {:flex 1}}
[react/text-input {:flex 1 [react/text-input {:flex 1
:ref #(when (and (nil? @topic-input-ref) %) :ref #(when (and (nil? @topic-input-ref) %)
(.setNativeProps % (js-obj "text" "#")) (.setNativeProps % (js-obj "text" "#"))
(reset! topic-input-ref %)) (reset! topic-input-ref %))
:style styles/add-contact-input :style styles/add-contact-input
:on-change (fn [e] :selection-color colors/hawkes-blue
(let [native-event (.-nativeEvent e) :on-change (fn [e]
text (.-text native-event) (let [native-event (.-nativeEvent e)
[_ before after] (first (re-seq #"(.*)\#(.*)" text))] text (.-text native-event)
(.setNativeProps @topic-input-ref (js-obj "text" (str "#" before after))) [_ before after] (first (re-seq #"(.*)\#(.*)" text))]
(re-frame/dispatch [:set :public-group-topic (subs text 1)])))}]] (.setNativeProps @topic-input-ref (js-obj "text" (str "#" before after)))
(re-frame/dispatch [:set :public-group-topic (subs text 1)])))}]]
[react/touchable-highlight {:disabled topic-error [react/touchable-highlight {:disabled topic-error
:on-press #(when-not topic-error :on-press #(when-not topic-error
(do (do

View File

@ -69,11 +69,12 @@
photo-path)} photo-path)}
:style styles/photo-style}]]))) :style styles/photo-style}]])))
(views/defview message-with-timestamp [text {:keys [timestamp] :as message} style] (views/defview message-with-timestamp [text {:keys [timestamp outgoing] :as message} style]
[react/view {:style style} [react/view {:style style}
[react/view {:style styles/message-wrapper} [react/view {:style styles/message-wrapper}
[react/text {:style styles/message-text [react/text {:style (styles/message-text message)
:selectable true} :selectable true
:selection-color (if outgoing colors/white colors/hawkes-blue)}
text] text]
[react/text {:style (styles/message-timestamp-placeholder)} [react/text {:style (styles/message-timestamp-placeholder)}
(time/timestamp->time timestamp)] (time/timestamp->time timestamp)]
@ -217,5 +218,6 @@
[react/text {:style (styles/contact-card-text colors/blue)} [react/text {:style (styles/contact-card-text colors/blue)}
(i18n/label :t/send-message)]]] (i18n/label :t/send-message)]]]
[react/text {:style styles/chat-profile-contact-code} (i18n/label :t/contact-code)] [react/text {:style styles/chat-profile-contact-code} (i18n/label :t/contact-code)]
[react/text {:style {:font-size 14} [react/text {:style {:font-size 14}
:selectable true} public-key]]])) :selectable true
:selection-color colors/hawkes-blue} public-key]]]))

View File

@ -42,7 +42,9 @@
[react/view {:style styles/qr-code} [react/view {:style styles/qr-code}
[qr-code-viewer/qr-code {:value public-key :size 130}]] [qr-code-viewer/qr-code {:value public-key :size 130}]]
[react/view {:style {:align-items :center}} [react/view {:style {:align-items :center}}
[react/text {:style styles/qr-code-text} [react/text {:style styles/qr-code-text
:selectable true
:selection-color colors/hawkes-blue}
public-key] public-key]
(when tooltip-opacity (when tooltip-opacity
[copied-tooltip tooltip-opacity])] [copied-tooltip tooltip-opacity])]