Fix rendering blink
This commit is contained in:
parent
2114cf5574
commit
0173e9ce8e
|
@ -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)})])
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue