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

Change window resize handler to switch to/from mobile layout as soon as needed (#11656)

parent 2e99e3ca
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -141,14 +141,24 @@ class SwitchingColumnsArea extends React.PureComponent { ...@@ -141,14 +141,24 @@ class SwitchingColumnsArea extends React.PureComponent {
return location.state !== previewMediaState && location.state !== previewVideoState; return location.state !== previewMediaState && location.state !== previewVideoState;
} }
handleResize = debounce(() => { handleLayoutChange = debounce(() => {
// The cached heights are no longer accurate, invalidate // The cached heights are no longer accurate, invalidate
this.props.onLayoutChange(); this.props.onLayoutChange();
this.setState({ mobile: isMobile(window.innerWidth) });
}, 500, { }, 500, {
trailing: true, trailing: true,
}); })
handleResize = () => {
const mobile = isMobile(window.innerWidth);
if (mobile !== this.state.mobile) {
this.handleLayoutChange.cancel();
this.props.onLayoutChange();
this.setState({ mobile });
} else {
this.handleLayoutChange();
}
}
setRef = c => { setRef = c => {
this.node = c.getWrappedInstance(); this.node = c.getWrappedInstance();
......
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