return location.state !== previewMediaState && location.state !== previewVideoState;
}
- handleResize = debounce(() => {
+ handleLayoutChange = debounce(() => {
// The cached heights are no longer accurate, invalidate
this.props.onLayoutChange();
-
- this.setState({ mobile: isMobile(window.innerWidth) });
}, 500, {
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 => {
this.node = c.getWrappedInstance();