From ceaa363f087ff825e5d74a9143332b9c834c9a01 Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Wed, 11 Jan 2023 18:37:42 +0800 Subject: [PATCH] fix: not using layout animation, causing flickers on android (#14753) --- src/react_native/reanimated.cljs | 5 +-- src/status_im2/common/toasts/view.cljs | 45 ++++++++++++++------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/react_native/reanimated.cljs b/src/react_native/reanimated.cljs index 4070d778d4..f397ff67f6 100644 --- a/src/react_native/reanimated.cljs +++ b/src/react_native/reanimated.cljs @@ -12,13 +12,10 @@ cancelAnimation SlideInUp SlideOutUp - LinearTransition - enableLayoutAnimations)] + LinearTransition)] [clojure.string :as string] [reagent.core :as reagent])) -(enableLayoutAnimations true) - ;; Animations (def slide-in-up-animation SlideInUp) (def slide-out-up-animation SlideOutUp) diff --git a/src/status_im2/common/toasts/view.cljs b/src/status_im2/common/toasts/view.cljs index 4fed016fa5..f8416bbfca 100644 --- a/src/status_im2/common/toasts/view.cljs +++ b/src/status_im2/common/toasts/view.cljs @@ -8,23 +8,23 @@ [status-im2.common.toasts.style :as style] [utils.re-frame :as rf])) -(def ^:private slide-out-up-animation - (-> ^js reanimated/slide-out-up-animation - .springify - (.damping 20) - (.stiffness 300))) +;; (def ^:private slide-out-up-animation +;; (-> ^js reanimated/slide-out-up-animation +;; .springify +;; (.damping 20) +;; (.stiffness 300))) -(def ^:private slide-in-up-animation - (-> ^js reanimated/slide-in-up-animation - .springify - (.damping 20) - (.stiffness 300))) +;; (def ^:private slide-in-up-animation +;; (-> ^js reanimated/slide-in-up-animation +;; .springify +;; (.damping 20) +;; (.stiffness 300))) -(def ^:private linear-transition - (-> ^js reanimated/linear-transition - .springify - (.damping 20) - (.stiffness 300))) +;; (def ^:private linear-transition +;; (-> ^js reanimated/linear-transition +;; .springify +;; (.damping 20) +;; (.stiffness 300))) (defn toast [id] @@ -81,12 +81,15 @@ (rn/use-unmount on-dismissed) [gesture/gesture-detector {:gesture pan} [reanimated/view - {:entering slide-in-up-animation - :exiting slide-out-up-animation - :layout reanimated/linear-transition - :style (reanimated/apply-animations-to-style - {:transform [{:translateY translate-y}]} - style/each-toast-container)} + {;; TODO: this will eanble layout animation at runtime and causing flicker on android + ;; we need to resolve this and re-enable layout animation + ;; issue at https://github.com/status-im/status-mobile/issues/14752 + ;; :entering slide-in-up-animation + ;; :exiting slide-out-up-animation + ;; :layout reanimated/linear-transition + :style (reanimated/apply-animations-to-style + {:transform [{:translateY translate-y}]} + style/each-toast-container)} [toast id]]]))]))) (defn toasts