Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable layout animations by default #16832

Merged
merged 2 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/react_native/reanimated.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions src/status_im2/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]))