Skip to content

Commit

Permalink
[#17309] fix: wrong cursor position in edit mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsen-ghafouri committed Sep 19, 2023
1 parent f18196d commit 8181331
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/status_im2/contexts/chat/composer/effects.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,15 @@
{:keys [edit]}]
(rn/use-effect
(fn []
(let [edit-text (get-in edit [:content :text])]
(let [edit-text (get-in edit [:content :text])
text-value-count (count @text-value)]
(when (and edit @input-ref)
(.focus ^js @input-ref)
(.setNativeProps ^js @input-ref (clj->js {:text edit-text}))
(reset! text-value edit-text)
(reset! saved-cursor-position (count edit-text)))))
(reset! saved-cursor-position (if (zero? text-value-count)
(count edit-text)
text-value-count)))))
[(:message-id edit)]))

(defn use-reply
Expand Down

0 comments on commit 8181331

Please sign in to comment.