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
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)

View File

@ -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