mirror of
https://github.com/status-im/status-react.git
synced 2025-01-11 03:26:31 +00:00
status hashtags, android: fix #1247
Summary: (.startsWith "#你好" "#") not works, but both (.startsWith "#你好" "#你") and (.startsWith "#abc" "#") works.
This commit is contained in:
parent
27536e55fe
commit
4d73c47e62
@ -37,8 +37,7 @@
|
|||||||
:background-color "#7099e619"
|
:background-color "#7099e619"
|
||||||
:border-radius 5
|
:border-radius 5
|
||||||
:padding 4}
|
:padding 4}
|
||||||
:item {:status-text {:color styles/color-black
|
:item {:status-text {:line-height 22
|
||||||
:line-height 22
|
|
||||||
:font-size 14}}}
|
:font-size 14}}}
|
||||||
:contacts {:show-all-text-font :medium}
|
:contacts {:show-all-text-font :medium}
|
||||||
:bottom-gradient {:height 3}
|
:bottom-gradient {:height 3}
|
||||||
|
@ -52,10 +52,12 @@
|
|||||||
:color common/color-black})
|
:color common/color-black})
|
||||||
|
|
||||||
(defnstyle status-view [placeholder?]
|
(defnstyle status-view [placeholder?]
|
||||||
(merge status-input-view
|
(-> (dissoc status-input-view :color)
|
||||||
{:color (if placeholder? common/color-gray common/color-black)
|
(cond-> placeholder?
|
||||||
:min-height 0
|
(assoc :color common/color-gray))
|
||||||
:ios {:padding-top 10}}))
|
(merge
|
||||||
|
{:min-height 0
|
||||||
|
:ios {:padding-top 10}})))
|
||||||
|
|
||||||
(def options-button
|
(def options-button
|
||||||
{:position :absolute
|
{:position :absolute
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[status-im.components.react :refer [view text]]
|
[status-im.components.react :refer [view text]]
|
||||||
[status-im.utils.platform :refer [platform-specific]]
|
[status-im.utils.platform :refer [platform-specific]]
|
||||||
[status-im.components.styles :refer [color-blue]]))
|
[status-im.components.styles :refer [color-blue color-black]]
|
||||||
|
[status-im.utils.utils :refer [hash-tag?]]))
|
||||||
|
|
||||||
(defn tag-view [tag]
|
(defn tag-view [tag]
|
||||||
[text {:style {:color color-blue}
|
[text {:style {:color color-blue}
|
||||||
@ -12,18 +13,21 @@
|
|||||||
(str tag " ")])
|
(str tag " ")])
|
||||||
|
|
||||||
(defn status-view [{:keys [style
|
(defn status-view [{:keys [style
|
||||||
|
non-tag-color
|
||||||
message-id
|
message-id
|
||||||
status
|
status
|
||||||
on-press
|
on-press
|
||||||
number-of-lines]
|
number-of-lines]
|
||||||
:or {message-id "msg"}}]
|
:or {message-id "msg"
|
||||||
|
non-tag-color color-black}}]
|
||||||
[text {:style style
|
[text {:style style
|
||||||
:on-press on-press
|
:on-press on-press
|
||||||
:number-of-lines number-of-lines
|
:number-of-lines number-of-lines
|
||||||
:font :default}
|
:font :default}
|
||||||
(for [[i status] (map-indexed vector (str/split status #" "))]
|
(for [[i status] (map-indexed vector (str/split status #" "))]
|
||||||
(if (.startsWith status "#")
|
(if (hash-tag? status)
|
||||||
^{:key (str "item-" message-id "-" i)}
|
^{:key (str "item-" message-id "-" i)}
|
||||||
[tag-view status]
|
[tag-view status]
|
||||||
^{:key (str "item-" message-id "-" i)}
|
^{:key (str "item-" message-id "-" i)}
|
||||||
(str status " ")))])
|
[text {:style {:color non-tag-color}}
|
||||||
|
(str status " ")]))])
|
||||||
|
@ -30,7 +30,8 @@
|
|||||||
[status-im.profile.handlers :refer [message-user]]
|
[status-im.profile.handlers :refer [message-user]]
|
||||||
[status-im.profile.styles :as st]
|
[status-im.profile.styles :as st]
|
||||||
[status-im.i18n :refer [label]]
|
[status-im.i18n :refer [label]]
|
||||||
[status-im.utils.datetime :as time]))
|
[status-im.utils.datetime :as time]
|
||||||
|
[status-im.utils.utils :refer [hash-tag?]]))
|
||||||
|
|
||||||
|
|
||||||
(defn my-profile-toolbar []
|
(defn my-profile-toolbar []
|
||||||
@ -137,7 +138,7 @@
|
|||||||
|
|
||||||
(defn colorize-status-hashtags [status]
|
(defn colorize-status-hashtags [status]
|
||||||
(for [[i status] (map-indexed vector (str/split status #" "))]
|
(for [[i status] (map-indexed vector (str/split status #" "))]
|
||||||
(if (.startsWith status "#")
|
(if (hash-tag? status)
|
||||||
^{:key (str "item-" i)}
|
^{:key (str "item-" i)}
|
||||||
[tag-view status]
|
[tag-view status]
|
||||||
^{:key (str "item-" i)}
|
^{:key (str "item-" i)}
|
||||||
|
@ -110,3 +110,6 @@
|
|||||||
|
|
||||||
(defn get-class [name]
|
(defn get-class [name]
|
||||||
(adapt-class (get-react-property name)))
|
(adapt-class (get-react-property name)))
|
||||||
|
|
||||||
|
(defn hash-tag? [s]
|
||||||
|
(= \# (first s)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user