diff --git a/src/status_im2/contexts/chat/composer/effects.cljs b/src/status_im2/contexts/chat/composer/effects.cljs index 326a05170c68..73a56ee7401e 100644 --- a/src/status_im2/contexts/chat/composer/effects.cljs +++ b/src/status_im2/contexts/chat/composer/effects.cljs @@ -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?]} @@ -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