parent
b7cc54a356
commit
7ec5117f54
|
@ -9,7 +9,6 @@
|
||||||
[status-im2.contexts.chat.composer.constants :as constants]
|
[status-im2.contexts.chat.composer.constants :as constants]
|
||||||
[status-im2.contexts.chat.composer.keyboard :as kb]
|
[status-im2.contexts.chat.composer.keyboard :as kb]
|
||||||
[status-im2.contexts.chat.composer.utils :as utils]
|
[status-im2.contexts.chat.composer.utils :as utils]
|
||||||
[utils.debounce :as debounce]
|
|
||||||
[utils.number :as utils.number]
|
[utils.number :as utils.number]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
|
@ -183,7 +182,7 @@
|
||||||
(when @input-ref
|
(when @input-ref
|
||||||
(.setNativeProps ^js @input-ref (clj->js {:text input-text})))
|
(.setNativeProps ^js @input-ref (clj->js {:text input-text})))
|
||||||
(reset! text-value input-text)
|
(reset! text-value input-text)
|
||||||
(debounce/debounce-and-dispatch [:mention/on-change-text input-text] 300)))
|
(rf/dispatch [:mention/on-change-text input-text])))
|
||||||
[input-text]))
|
[input-text]))
|
||||||
|
|
||||||
(defn did-mount
|
(defn did-mount
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
(ns status-im2.contexts.chat.composer.handlers
|
(ns status-im2.contexts.chat.composer.handlers
|
||||||
(:require
|
(:require
|
||||||
|
[clojure.string :as string]
|
||||||
[oops.core :as oops]
|
[oops.core :as oops]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[react-native.reanimated :as reanimated]
|
[react-native.reanimated :as reanimated]
|
||||||
|
@ -60,7 +61,7 @@
|
||||||
|
|
||||||
(defn content-size-change
|
(defn content-size-change
|
||||||
[event
|
[event
|
||||||
{:keys [maximized? lock-layout?]}
|
{:keys [maximized? lock-layout? text-value]}
|
||||||
{:keys [height saved-height opacity background-y]}
|
{:keys [height saved-height opacity background-y]}
|
||||||
{:keys [content-height window-height max-height]}
|
{:keys [content-height window-height max-height]}
|
||||||
keyboard-shown]
|
keyboard-shown]
|
||||||
|
@ -68,7 +69,7 @@
|
||||||
(let [event-size (oops/oget event "nativeEvent.contentSize.height")
|
(let [event-size (oops/oget event "nativeEvent.contentSize.height")
|
||||||
content-size (+ event-size constants/extra-content-offset)
|
content-size (+ event-size constants/extra-content-offset)
|
||||||
lines (utils/calc-lines event-size)
|
lines (utils/calc-lines event-size)
|
||||||
content-size (if (= lines 1)
|
content-size (if (or (= lines 1) (empty? @text-value))
|
||||||
constants/input-height
|
constants/input-height
|
||||||
(if (= lines 2) constants/multiline-minimized-height content-size))
|
(if (= lines 2) constants/multiline-minimized-height content-size))
|
||||||
new-height (utils/bounded-val content-size constants/input-height max-height)]
|
new-height (utils/bounded-val content-size constants/input-height max-height)]
|
||||||
|
@ -120,7 +121,9 @@
|
||||||
(@record-reset-fn)
|
(@record-reset-fn)
|
||||||
(reset! recording? false))
|
(reset! recording? false))
|
||||||
(rf/dispatch [:chat.ui/set-chat-input-text text])
|
(rf/dispatch [:chat.ui/set-chat-input-text text])
|
||||||
(debounce/debounce-and-dispatch [:mention/on-change-text text] 300))
|
(if (string/ends-with? text "@")
|
||||||
|
(rf/dispatch [:mention/on-change-text text])
|
||||||
|
(debounce/debounce-and-dispatch [:mention/on-change-text text] 300)))
|
||||||
|
|
||||||
(defn selection-change
|
(defn selection-change
|
||||||
[event
|
[event
|
||||||
|
|
|
@ -143,7 +143,6 @@
|
||||||
base
|
base
|
||||||
(+ constants/actions-container-height (:bottom insets) (- curr-height cursor-pos) 18)))))
|
(+ constants/actions-container-height (:bottom insets) (- curr-height cursor-pos) 18)))))
|
||||||
|
|
||||||
|
|
||||||
(defn init-props
|
(defn init-props
|
||||||
[]
|
[]
|
||||||
{:input-ref (atom nil)
|
{:input-ref (atom nil)
|
||||||
|
|
Loading…
Reference in New Issue