Skip to content
Extraits de code Groupes Projets
Valider 69543977 rédigé par unarist's avatar unarist Validation de Eugen Rochko
Parcourir les fichiers

Fix column swiping (#4211)

This fixes broken behavior and enable animation only on swiping.
parent 05cd3709
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -33,8 +33,22 @@ export default class ColumnsArea extends ImmutablePureComponent { ...@@ -33,8 +33,22 @@ export default class ColumnsArea extends ImmutablePureComponent {
children: PropTypes.node, 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() { componentDidUpdate() {
this.lastIndex = getIndex(this.context.router.history.location.pathname); this.lastIndex = getIndex(this.context.router.history.location.pathname);
this.setState({ shouldAnimate: true });
} }
handleSwipe = (index) => { handleSwipe = (index) => {
...@@ -74,9 +88,10 @@ export default class ColumnsArea extends ImmutablePureComponent { ...@@ -74,9 +88,10 @@ export default class ColumnsArea extends ImmutablePureComponent {
render () { render () {
const { columns, children, singleColumn } = this.props; const { columns, children, singleColumn } = this.props;
const { shouldAnimate } = this.state;
const columnIndex = getIndex(this.context.router.history.location.pathname); const columnIndex = getIndex(this.context.router.history.location.pathname);
const shouldAnimate = Math.abs(this.lastIndex - columnIndex) === 1; this.pendingIndex = null;
if (singleColumn) { if (singleColumn) {
return columnIndex !== -1 ? ( return columnIndex !== -1 ? (
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter