Compare commits

...
6 Commits
Author SHA1 Message Date
ibrkhalil 5cd8f9aa45 fix selectable text input repeating 2023-01-08 11:53:01 +02:00
ibrkhalil d6ce375b8e Clean 2023-01-08 11:26:34 +02:00
ibrkhalil 9d1bb5e3c0 Fix children warning 2023-01-08 11:25:31 +02:00
ibrkhalil 4f64982654 remove repeating mentions 2023-01-08 10:09:17 +02:00
ibrkhalil d2e5c955bf Remove warning from iOS 2023-01-08 08:45:25 +02:00
ibrkhalil 1695003d2e Remove react warning 2023-01-08 08:43:06 +02:00
2 changed files with 13 additions and 17 deletions
+3 -4
View File
@@ -49,10 +49,9 @@
cursor (+ at-sign-idx (count name) 2)]
(rf/merge
cofx
{:db (-> db
(assoc-in [:chats/cursor chat-id] cursor)
(assoc-in [:chats/mention-suggestions chat-id] nil))
:set-text-input-value [chat-id new-text text-input-ref]}
{:db (-> db
(assoc-in [:chats/cursor chat-id] cursor)
(assoc-in [:chats/mention-suggestions chat-id] nil))}
(set-chat-input-text new-text chat-id)
;; NOTE(rasom): Some keyboards do not react on selection property passed to
;; text input (specifically Samsung keyboard with predictive text set on).
@@ -175,7 +175,6 @@
:editable (not cooldown-enabled?)
:blur-on-submit false
:auto-focus false
:default-value initial-value
:on-focus #(set-active-panel nil)
:max-length chat.constants/max-text-size
:placeholder-text-color (:text-02 @quo.colors/theme)
@@ -195,15 +194,14 @@
(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)}
input-with-mentions (rf/sub [:chat/input-with-mentions])
children (fn []
(if mentions-enabled?
(map-indexed
(fn [index [_ text]]
^{:key (str index "_" type "_" text)}
[rn/text (when (= type :mention) {:style {:color colors/primary-50}})
text])
input-with-mentions)
(get @input-texts chat-id)))]
children (if mentions-enabled?
(map-indexed
(fn [index [type text]]
^{:key (str index "_" type "_" text)}
[rn/text (when (= type :mention) {:style {:color colors/primary-50}})
text])
input-with-mentions)
(get @input-texts chat-id))]
(reset! text-input-ref (:text-input-ref refs))
;when ios implementation for selectable-text-input is ready, we need remove this condition and use
;selectable-text-input directly.
@@ -224,8 +222,7 @@
(defn update-input-text
[{:keys [text-input chat-id]} text]
(on-text-change text chat-id)
(.setNativeProps ^js text-input (clj->js {:text text})))
(on-text-change text chat-id))
(re-frame/reg-fx
:set-text-input-value
@@ -338,7 +335,7 @@
(oops/ocall manager :startActionMode text-input-handle))))
:reagent-render
(fn [_]
(fn [chat-id {:keys [style ref on-selection-change] :as props} children]
(let [ref #(do (reset! text-input-ref %)
(when ref
(quo.react/set-ref-val! ref %)))