fix: not using layout animation, causing flickers on android (#14753)

This commit is contained in:
yqrashawn 2023-01-11 18:37:42 +08:00 committed by GitHub
parent 846d628a9d
commit ceaa363f08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 25 deletions

View File

@ -12,13 +12,10 @@
cancelAnimation cancelAnimation
SlideInUp SlideInUp
SlideOutUp SlideOutUp
LinearTransition LinearTransition)]
enableLayoutAnimations)]
[clojure.string :as string] [clojure.string :as string]
[reagent.core :as reagent])) [reagent.core :as reagent]))
(enableLayoutAnimations true)
;; Animations ;; Animations
(def slide-in-up-animation SlideInUp) (def slide-in-up-animation SlideInUp)
(def slide-out-up-animation SlideOutUp) (def slide-out-up-animation SlideOutUp)

View File

@ -8,23 +8,23 @@
[status-im2.common.toasts.style :as style] [status-im2.common.toasts.style :as style]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
(def ^:private slide-out-up-animation ;; (def ^:private slide-out-up-animation
(-> ^js reanimated/slide-out-up-animation ;; (-> ^js reanimated/slide-out-up-animation
.springify ;; .springify
(.damping 20) ;; (.damping 20)
(.stiffness 300))) ;; (.stiffness 300)))
(def ^:private slide-in-up-animation ;; (def ^:private slide-in-up-animation
(-> ^js reanimated/slide-in-up-animation ;; (-> ^js reanimated/slide-in-up-animation
.springify ;; .springify
(.damping 20) ;; (.damping 20)
(.stiffness 300))) ;; (.stiffness 300)))
(def ^:private linear-transition ;; (def ^:private linear-transition
(-> ^js reanimated/linear-transition ;; (-> ^js reanimated/linear-transition
.springify ;; .springify
(.damping 20) ;; (.damping 20)
(.stiffness 300))) ;; (.stiffness 300)))
(defn toast (defn toast
[id] [id]
@ -81,9 +81,12 @@
(rn/use-unmount on-dismissed) (rn/use-unmount on-dismissed)
[gesture/gesture-detector {:gesture pan} [gesture/gesture-detector {:gesture pan}
[reanimated/view [reanimated/view
{:entering slide-in-up-animation {;; TODO: this will eanble layout animation at runtime and causing flicker on android
:exiting slide-out-up-animation ;; we need to resolve this and re-enable layout animation
:layout reanimated/linear-transition ;; 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 :style (reanimated/apply-animations-to-style
{:transform [{:translateY translate-y}]} {:transform [{:translateY translate-y}]}
style/each-toast-container)} style/each-toast-container)}