Fix mentions animation when disappearing (#15879)

* fix: suggestions list animation
This commit is contained in:
Omar Basem 2023-05-11 22:33:25 +04:00 committed by GitHub
parent c71224e73e
commit 264b7ffab9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -30,7 +30,7 @@
user]) user])
(defn- f-view (defn- f-view
[suggestions-atom props state animations {:keys [reply edit images]} max-height cursor-pos] [suggestions-atom props state animations max-height cursor-pos images reply edit]
(let [suggestions (rf/sub [:chat/mention-suggestions]) (let [suggestions (rf/sub [:chat/mention-suggestions])
opacity (reanimated/use-shared-value (if (seq suggestions) 1 0)) opacity (reanimated/use-shared-value (if (seq suggestions) 1 0))
size (count suggestions) size (count suggestions)
@ -38,9 +38,9 @@
:insets (safe-area/get-insets) :insets (safe-area/get-insets)
:curr-height (reanimated/get-shared-value (:height animations)) :curr-height (reanimated/get-shared-value (:height animations))
:window-height (:height (rn/get-window)) :window-height (:height (rn/get-window))
:images images
:reply reply :reply reply
:edit edit :edit edit}
:images images}
mentions-pos (utils/calc-suggestions-position cursor-pos max-height size state data)] mentions-pos (utils/calc-suggestions-position cursor-pos max-height size state data)]
(rn/use-effect (rn/use-effect
(fn [] (fn []
@ -61,6 +61,6 @@
:accessibility-label :mentions-list}]])) :accessibility-label :mentions-list}]]))
(defn view (defn view
[props state animations subs max-height cursor-pos] [props state animations max-height cursor-pos images reply edit]
(let [suggestions-atom (reagent/atom {})] (let [suggestions-atom (reagent/atom {})]
[:f> f-view suggestions-atom props state animations subs max-height cursor-pos])) [:f> f-view suggestions-atom props state animations max-height cursor-pos images reply edit]))

View File

@ -62,7 +62,8 @@
(effects/edit-mentions props state subs) (effects/edit-mentions props state subs)
[:<> [:<>
[sub-view/shell-button state animations subs] [sub-view/shell-button state animations subs]
[mentions/view props state animations subs max-height cursor-pos] [mentions/view props state animations max-height cursor-pos (:images subs) (:reply subs)
(:edit subs)]
[gesture/gesture-detector [gesture/gesture-detector
{:gesture (drag-gesture/drag-gesture props state animations dimensions keyboard-shown)} {:gesture (drag-gesture/drag-gesture props state animations dimensions keyboard-shown)}
[reanimated/view [reanimated/view