Skip to content

Commit

Permalink
fix: composer size when re-entering with unfinished multiline message
Browse files Browse the repository at this point in the history
  • Loading branch information
clauxx committed Dec 6, 2023
1 parent 7e14846 commit 4de0e91
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/status_im2/contexts/chat/composer/effects.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,21 @@
(defn reenter-screen-effect
[{:keys [text-value saved-cursor-position maximized?]}
{:keys [content-height]}
{:keys [input-content-height input-text input-maximized?]}]
(when (and (empty? @text-value) (not= input-text nil))
(reset! text-value input-text)
(reset! content-height input-content-height)
(reset! saved-cursor-position (count input-text)))
(when input-maximized?
(reset! maximized? true)))
{:keys [input-content-height input-text input-maximized?]}
{:keys [height last-height saved-height]}]
(let [lines (utils/calc-lines input-content-height)
minimized-height (if (or (= lines 1) (empty? input-text))
constants/input-height
constants/multiline-minimized-height)]
(when (and (empty? @text-value) (not= input-text nil))
(reset! text-value input-text)
(reset! content-height input-content-height)
(reset! saved-cursor-position (count input-text))
(reanimated/set-shared-value height minimized-height)
(reanimated/set-shared-value last-height input-content-height)
(reanimated/set-shared-value saved-height input-content-height))
(when input-maximized?
(reset! maximized? true))))

(defn maximized-effect
[{:keys [maximized?]}
Expand Down Expand Up @@ -101,7 +109,7 @@
[max-height])
(rn/use-effect
(fn []
(reenter-screen-effect state dimensions subscriptions))
(reenter-screen-effect state dimensions subscriptions animations))
[max-height subscriptions]))

(defn use-edit
Expand Down

0 comments on commit 4de0e91

Please sign in to comment.