mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-24 13:35:07 +01:00
Fix column swiping (#4211)
This fixes broken behavior and enable animation only on swiping.
This commit is contained in:
parent
05cd37097c
commit
695439775e
@ -33,8 +33,22 @@ export default class ColumnsArea extends ImmutablePureComponent {
|
||||
children: PropTypes.node,
|
||||
};
|
||||
|
||||
state = {
|
||||
shouldAnimate: false,
|
||||
}
|
||||
|
||||
componentWillReceiveProps() {
|
||||
this.setState({ shouldAnimate: false });
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.lastIndex = getIndex(this.context.router.history.location.pathname);
|
||||
this.setState({ shouldAnimate: true });
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
this.lastIndex = getIndex(this.context.router.history.location.pathname);
|
||||
this.setState({ shouldAnimate: true });
|
||||
}
|
||||
|
||||
handleSwipe = (index) => {
|
||||
@ -74,9 +88,10 @@ export default class ColumnsArea extends ImmutablePureComponent {
|
||||
|
||||
render () {
|
||||
const { columns, children, singleColumn } = this.props;
|
||||
const { shouldAnimate } = this.state;
|
||||
|
||||
const columnIndex = getIndex(this.context.router.history.location.pathname);
|
||||
const shouldAnimate = Math.abs(this.lastIndex - columnIndex) === 1;
|
||||
this.pendingIndex = null;
|
||||
|
||||
if (singleColumn) {
|
||||
return columnIndex !== -1 ? (
|
||||
|
Loading…
Reference in New Issue
Block a user