diff --git a/src/status_im/contexts/chat/messenger/composer/mentions/view.cljs b/src/status_im/contexts/chat/messenger/composer/mentions/view.cljs index 75a51fcc4c..a0c43dc70d 100644 --- a/src/status_im/contexts/chat/messenger/composer/mentions/view.cljs +++ b/src/status_im/contexts/chat/messenger/composer/mentions/view.cljs @@ -10,25 +10,27 @@ [status-im.contexts.chat.messenger.messages.constants :as messages.constants] [utils.re-frame :as rf])) -(defn mention-item - [user] - [contact-list-item/contact-list-item - {:on-press #(rf/dispatch [:chat.ui/select-mention user])} - user]) +(defn- mention-item + [[user-key user]] + (with-meta + [contact-list-item/contact-list-item {:on-press #(rf/dispatch [:chat.ui/select-mention user])} + user] + {:key user-key})) (defn view [layout-height] - (let [suggestions (rf/sub [:chat/mention-suggestions]) - suggestions? (seq suggestions) - theme (quo.theme/use-theme) - opacity (reanimated/use-shared-value (if suggestions? 1 0)) - [suggestions-state set-suggestions-state] (rn/use-state suggestions) - top (min constants/mentions-max-height - (* (count suggestions-state) 56) - (- @layout-height - (+ (safe-area/get-top) - messages.constants/top-bar-height - 5)))] + (let [suggestions (rf/sub [:chat/mention-suggestions]) + suggestions? (seq suggestions) + theme (quo.theme/use-theme) + opacity (reanimated/use-shared-value (if suggestions? 1 0)) + [suggestions-state + set-suggestions-state] (rn/use-state suggestions) + top (min constants/mentions-max-height + (* (count suggestions-state) 56) + (- @layout-height + (+ (safe-area/get-top) + messages.constants/top-bar-height + 5)))] (rn/use-effect (fn [] (if suggestions? @@ -37,9 +39,6 @@ (reanimated/animate opacity (if suggestions? 1 0))) [suggestions]) [reanimated/view {:style (style/container opacity top theme)} - [reanimated/flat-list - {:keyboard-should-persist-taps :always - :data (vals suggestions-state) - :key-fn :key - :render-fn mention-item - :accessibility-label :mentions-list}]])) + [rn/scroll-view {:accessibility-label :mentions-list + :keyboard-should-persist-taps :always} + (map mention-item suggestions-state)]]))