diff --git a/ElementX/Sources/Other/SwiftUI/Animation/ElementAnimations.swift b/ElementX/Sources/Other/SwiftUI/Animation/ElementAnimations.swift index e78ec1bace..3bb350b5ff 100644 --- a/ElementX/Sources/Other/SwiftUI/Animation/ElementAnimations.swift +++ b/ElementX/Sources/Other/SwiftUI/Animation/ElementAnimations.swift @@ -23,7 +23,7 @@ public extension Animation { /// `noAnimation` if running UI tests, otherwise `default` animation. static var elementDefault: Animation { - Tests.isRunningUITests ? .noAnimation : .default + Tests.isRunningUITests ? .noAnimation : (UIAccessibility.isReduceMotionEnabled ? .noAnimation : .default) } } diff --git a/ElementX/Sources/Screens/RoomScreen/View/Timeline/TimelineTableViewController.swift b/ElementX/Sources/Screens/RoomScreen/View/Timeline/TimelineTableViewController.swift index b6a7c0e8ba..7d25fe1a4e 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Timeline/TimelineTableViewController.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Timeline/TimelineTableViewController.swift @@ -181,8 +181,17 @@ class TimelineTableViewController: UIViewController { // We only animate when there's a new last message, so its safe // to animate from the bottom (which is the top as we're flipped). - dataSource?.defaultRowAnimation = .top + dataSource?.defaultRowAnimation = (UIAccessibility.isReduceMotionEnabled ? .none : .top) tableView.delegate = self + + NotificationCenter.default.addObserver(self, + selector: #selector(accessibilityReduceMotionDidChange), + name: UIAccessibility.reduceMotionStatusDidChangeNotification, + object: nil) + } + + @objc private func accessibilityReduceMotionDidChange() { + dataSource?.defaultRowAnimation = (UIAccessibility.isReduceMotionEnabled ? .none : .top) } /// Updates the table view with the latest items from the ``timelineItems`` array. After