From a25fe11614b0d3899d5a46e4010b9e8c233410d9 Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Mon, 13 May 2024 14:45:29 +0800 Subject: [PATCH] fix: hide reactions in reaction drawer message preview --- .../messages/content/reactions/view.cljs | 49 ++++++++++--------- .../chat/messenger/messages/content/view.cljs | 18 ++++--- 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/src/status_im/contexts/chat/messenger/messages/content/reactions/view.cljs b/src/status_im/contexts/chat/messenger/messages/content/reactions/view.cljs index bcb78c0ddbd9..38ffdfa23764 100644 --- a/src/status_im/contexts/chat/messenger/messages/content/reactions/view.cljs +++ b/src/status_im/contexts/chat/messenger/messages/content/reactions/view.cljs @@ -15,7 +15,7 @@ :emoji-id emoji-id}]))) (defn- on-long-press - [{:keys [message-id emoji-id user-message-content reactions-order theme]}] + [{:keys [message-id emoji-id user-message-content-render-fn reactions-order theme]}] (rf/dispatch [:reactions/get-authors-by-message-id {:message-id message-id @@ -31,19 +31,19 @@ [drawers/reaction-authors {:reactions-order reactions-order :theme theme}]) - :selected-item (fn [] user-message-content) + :selected-item (fn [] [user-message-content-render-fn + {:hide-reactions? true}]) :padding-bottom-override 0}]))}])) (defn- on-press-add - [{:keys [chat-id message-id user-message-content]}] + [{:keys [chat-id message-id user-message-content-render-fn]}] (rf/dispatch [:dismiss-keyboard]) (rf/dispatch [:show-bottom-sheet {:content (fn [] [drawers/reactions {:chat-id chat-id :message-id message-id}]) - :selected-item (fn [] - user-message-content)}])) + :selected-item (fn [] [user-message-content-render-fn])}])) (defn- add-emoji-key [reaction] @@ -52,24 +52,25 @@ (get constants/reactions (:emoji-id reaction)))) (defn message-reactions-row - [{:keys [message-id chat-id pinned-by hide-new-reaction-button?]} user-message-content] + [{:keys [message-id chat-id pinned-by hide-new-reaction-button?]} user-message-content-render-fn] (let [theme (quo.theme/use-theme) reactions (rf/sub [:chats/message-reactions message-id chat-id])] - [:<> - (when (seq reactions) - [quo/react - {:container-style {:margin-left 44 - :margin-top 8} - :reactions (map add-emoji-key reactions) - :hide-new-reaction-button? hide-new-reaction-button? - :use-case (when pinned-by :pinned) - :on-press #(on-press (assoc % :message-id message-id)) - :on-long-press #(on-long-press (assoc % - :message-id message-id - :theme theme - :reactions-order (map :emoji-id - reactions) - :user-message-content user-message-content)) - :on-press-add #(on-press-add {:chat-id chat-id - :message-id message-id - :user-message-content user-message-content})}])])) + (when (seq reactions) + [quo/react + {:container-style {:margin-left 44 + :margin-top 8} + :reactions (map add-emoji-key reactions) + :hide-new-reaction-button? hide-new-reaction-button? + :use-case (when pinned-by :pinned) + :on-press #(on-press (assoc % :message-id message-id)) + :on-long-press #(on-long-press (assoc % + :message-id message-id + :theme theme + :reactions-order (map :emoji-id + reactions) + :user-message-content-render-fn + user-message-content-render-fn)) + :on-press-add #(on-press-add {:chat-id chat-id + :message-id message-id + :user-message-content-render-fn + user-message-content-render-fn})}]))) diff --git a/src/status_im/contexts/chat/messenger/messages/content/view.cljs b/src/status_im/contexts/chat/messenger/messages/content/view.cljs index b1bc99f461fd..953e1ac66b2a 100644 --- a/src/status_im/contexts/chat/messenger/messages/content/view.cljs +++ b/src/status_im/contexts/chat/messenger/messages/content/view.cljs @@ -265,13 +265,17 @@ [status/status outgoing-status])])] (when-not hide-reactions? [reactions/message-reactions-row (assoc message-data :hide-new-reaction-button? true) - [rn/view {:pointer-events :none} - [user-message-content - {:theme theme - :message-data message-data - :context context - :in-reaction-or-action-menu? true - :keyboard-shown? keyboard-shown?}]]])]])))) + (fn [override-opts] + [rn/view + {:pointer-events :none + :style style/drawer-message-container} + [user-message-content + (merge {:theme theme + :message-data message-data + :context context + :in-reaction-or-action-menu? true + :keyboard-shown? keyboard-shown?} + override-opts)]])])]])))) (defn on-long-press [{:keys [deleted? deleted-for-me?] :as message-data} context keyboard-shown?]