From 0b437325dc93a1d28202b5ff30eaafc9b4e571b7 Mon Sep 17 00:00:00 2001
From: ThibG <thib@sitedethib.com>
Date: Mon, 7 Dec 2020 20:07:24 +0100
Subject: [PATCH] Fix column swiping animation logic (#15301)
From the start, swiping columns was highly unreliable because the logic
could change `ReactSwipeableViews`'s `animateTransitions` property
mid-swipe.
PR #11200 partially fixed this, but at the unintended cost of disabling the
swipe animation altogether.
This PR changes the logic behind `shouldAnimate` to only disable the swiping
animation at the end of a column change not initiated by `ReactSwipeableViews`.
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
---
.../mastodon/features/ui/components/columns_area.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/javascript/mastodon/features/ui/components/columns_area.js b/app/javascript/mastodon/features/ui/components/columns_area.js
index cf02e9be7d..6837450eb5 100644
--- a/app/javascript/mastodon/features/ui/components/columns_area.js
+++ b/app/javascript/mastodon/features/ui/components/columns_area.js
@@ -75,7 +75,9 @@ class ColumnsArea extends ImmutablePureComponent {
}
componentWillReceiveProps() {
- this.setState({ shouldAnimate: false });
+ if (typeof this.pendingIndex !== 'number' && this.lastIndex !== getIndex(this.context.router.history.location.pathname)) {
+ this.setState({ shouldAnimate: false });
+ }
}
componentDidMount() {
--
GitLab