From 109061a112795e32d59052e138e4b4aced5e74d2 Mon Sep 17 00:00:00 2001 From: Parvesh Monu Date: Thu, 3 Aug 2023 18:53:15 +0530 Subject: [PATCH] Enable layout animations by default (#16832) Co-authored-by: Jamie Caprani --- src/react_native/reanimated.cljs | 3 +++ src/status_im2/core.cljs | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/src/react_native/reanimated.cljs b/src/react_native/reanimated.cljs index 37b50840a4..d0bce3a27f 100644 --- a/src/react_native/reanimated.cljs +++ b/src/react_native/reanimated.cljs @@ -17,12 +17,15 @@ SlideInUp SlideOutUp LinearTransition + enableLayoutAnimations runOnJS)] [reagent.core :as reagent] ["react-native-redash" :refer (withPause)] [react-native.flat-list :as rn-flat-list] [utils.worklets.core :as worklets.core])) +(def enable-layout-animations enableLayoutAnimations) + (def ^:const default-duration 300) ;; Animations diff --git a/src/status_im2/core.cljs b/src/status_im2/core.cljs index ba8fcc9881..f4da25ca9c 100644 --- a/src/status_im2/core.cljs +++ b/src/status_im2/core.cljs @@ -7,6 +7,7 @@ [react-native.core :as rn] [react-native.platform :as platform] [react-native.shake :as react-native-shake] + [react-native.reanimated :as reanimated] [reagent.impl.batching :as batching] [status-im2.contexts.shell.jump-to.utils :as shell.utils] [status-im2.contexts.shell.jump-to.state :as shell.state] @@ -47,6 +48,14 @@ (async-storage/get-item :selected-stack-id #(shell.utils/change-selected-stack-id % nil nil)) (async-storage/get-item :screen-height #(reset! shell.state/screen-height %)) + ;; Note - We have to enable layout animations manually at app startup, + ;; otherwise, they will be enabled at runtime when they are used and will cause few bugs. + ;; https://github.com/status-im/status-mobile/issues/16693 + ;; We can remove this call, once reanimated library is upgraded to v3. + ;; Also, we can't move this call to reanimated.cljs file, + ;; because that causes component tests to fail. (as function is not mocked in library jestUtils) + (reanimated/enable-layout-animations true) + (dev/setup) (re-frame/dispatch-sync [:app-started]))