From 0173e9ce8ef963531e31b9f77302aeecc152206e Mon Sep 17 00:00:00 2001 From: Ulises M Date: Tue, 19 Nov 2024 15:04:31 -0600 Subject: [PATCH] Fix rendering blink --- .../messenger/composer/mentions/style.cljs | 51 +++++++++++-------- .../messenger/composer/mentions/view.cljs | 25 +++++---- 2 files changed, 42 insertions(+), 34 deletions(-) diff --git a/src/status_im/contexts/chat/messenger/composer/mentions/style.cljs b/src/status_im/contexts/chat/messenger/composer/mentions/style.cljs index d38fb20b1a..9e4afc625a 100644 --- a/src/status_im/contexts/chat/messenger/composer/mentions/style.cljs +++ b/src/status_im/contexts/chat/messenger/composer/mentions/style.cljs @@ -2,29 +2,38 @@ (:require [quo.foundations.colors :as colors] [react-native.platform :as platform] - [react-native.reanimated :as reanimated] [status-im.contexts.chat.messenger.composer.constants :as constants])) -(defn shadow - [theme] - (if platform/ios? - {:shadow-radius (colors/theme-colors 30 50 theme) - :shadow-opacity (colors/theme-colors 0.1 0.7 theme) - :shadow-color colors/neutral-100 - :shadow-offset {:width 0 :height (colors/theme-colors 8 12 theme)}} - {:elevation 10})) +(defn- add-shadow + [theme styles] + (cond-> styles + platform/ios? (assoc :shadow-radius (colors/theme-colors 30 50 theme) + :shadow-opacity (colors/theme-colors 0.1 0.7 theme) + :shadow-color colors/neutral-100 + :shadow-offset {:width 0 :height (colors/theme-colors 8 12 theme)}) + :else (assoc :elevation 10))) + +(defn inner + [top theme] + (add-shadow theme + {:position :absolute + :top (- (+ 8 top)) + :left 8 + :right 8 + :border-radius 16 + :z-index 4 + :max-height constants/mentions-max-height + :background-color (colors/theme-colors colors/white colors/neutral-95 theme)})) (defn container [opacity top theme] - (reanimated/apply-animations-to-style - {:opacity opacity} - (merge - {:position :absolute - :top (- (+ 8 top)) - :left 8 - :right 8 - :border-radius 16 - :z-index 4 - :max-height constants/mentions-max-height - :background-color (colors/theme-colors colors/white colors/neutral-95 theme)} - (shadow theme)))) + [{:opacity opacity} + (add-shadow theme + {:position :absolute + :top (- (+ 8 top)) + :left 8 + :right 8 + :border-radius 16 + :z-index 4 + :max-height constants/mentions-max-height + :background-color (colors/theme-colors colors/white colors/neutral-95 theme)})]) 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 1321209916..27bf4972a1 100644 --- a/src/status_im/contexts/chat/messenger/composer/mentions/view.cljs +++ b/src/status_im/contexts/chat/messenger/composer/mentions/view.cljs @@ -1,14 +1,14 @@ (ns status-im.contexts.chat.messenger.composer.mentions.view (:require - [quo.theme] - [react-native.core :as rn] - [react-native.reanimated :as reanimated] - [react-native.safe-area :as safe-area] - [status-im.common.contact-list-item.view :as contact-list-item] - [status-im.contexts.chat.messenger.composer.constants :as constants] - [status-im.contexts.chat.messenger.composer.mentions.style :as style] - [status-im.contexts.chat.messenger.messages.constants :as messages.constants] - [utils.re-frame :as rf])) + [quo.theme] + [react-native.core :as rn] + [react-native.reanimated :as reanimated] + [react-native.safe-area :as safe-area] + [status-im.common.contact-list-item.view :as contact-list-item] + [status-im.contexts.chat.messenger.composer.constants :as constants] + [status-im.contexts.chat.messenger.composer.mentions.style :as style] + [status-im.contexts.chat.messenger.messages.constants :as messages.constants] + [utils.re-frame :as rf])) (defn mention-item [user] @@ -35,10 +35,9 @@ (set-suggestions-state suggestions) (js/setTimeout #(set-suggestions-state suggestions) 300)) (reanimated/animate opacity (if suggestions? 1 0))) - [suggestions?]) - [reanimated/view - {:style (style/container opacity top theme)} - [rn/flat-list + [suggestions]) + [reanimated/view {:style (style/container opacity top theme)} + [reanimated/flat-list {:keyboard-should-persist-taps :always :data (vals suggestions-state) :key-fn :key