[14429] Fix mentions (#14442)

This commit is contained in:
Ibrahem Khalil 2022-11-25 15:04:15 +02:00 committed by GitHub
parent 9de4417f03
commit 3d71fdba98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -172,21 +172,21 @@
:on-selection-change (partial on-selection-change timeout-id last-text-change mentionable-users) :on-selection-change (partial on-selection-change timeout-id last-text-change mentionable-users)
:on-change (partial on-change last-text-change timeout-id mentionable-users refs chat-id sending-image) :on-change (partial on-change last-text-change timeout-id mentionable-users refs chat-id sending-image)
:on-text-input (partial on-text-input mentionable-users chat-id)} :on-text-input (partial on-text-input mentionable-users chat-id)}
input-with-mentions (<sub [:chat/input-with-mentions])
children (fn [] children (fn []
(if mentions-enabled (if mentions-enabled
(for [[index [type text]] (map-indexed (map-indexed
(fn [idx item] (fn [index [item text]]
[idx item]) [index [item]]
(<sub [:chat/input-with-mentions]))] ^{:key (str index "_" type "_" text)}
^{:key (str index "_" type "_" text)} [rn/text (when (= type :mention) {:style {:color colors/primary-50}})
[rn/text (when (= type :mention) {:style {:color colors/primary-50}}) text]) input-with-mentions)
text])
(get @input-texts chat-id)))] (get @input-texts chat-id)))]
;when ios implementation for selectable-text-input is ready, we need remove this condition and use selectable-text-input directly. ;when ios implementation for selectable-text-input is ready, we need remove this condition and use selectable-text-input directly.
(if platform/android? (if platform/android?
[selectable-text-input chat-id props children] [selectable-text-input chat-id props children]
[rn/text-input props [rn/text-input props
[children]]))) children])))
(defn selectable-text-input-manager [] (defn selectable-text-input-manager []
(when (exists? (.-NativeModules react-native)) (when (exists? (.-NativeModules react-native))