'FAVOURITES': FavouritedStatuses,
};
-@injectIntl
+@component => injectIntl(component, { withRef: true })
export default class ColumnsArea extends ImmutablePureComponent {
static contextTypes = {
this.setState({ shouldAnimate: true });
}
- componentDidUpdate(prevProps) {
+ componentDidUpdate() {
this.lastIndex = getIndex(this.context.router.history.location.pathname);
this.setState({ shouldAnimate: true });
+ }
- if (this.props.children !== prevProps.children && !this.props.singleColumn) {
- scrollRight(this.node);
- }
+ handleChildrenContentChange() {
+ scrollRight(this.node);
}
handleSwipe = (index) => {
import React from 'react';
import classNames from 'classnames';
-import Redirect from 'react-router-dom/Redirect';
import NotificationsContainer from './containers/notifications_container';
import PropTypes from 'prop-types';
import LoadingBarContainer from './containers/loading_bar_container';
import TabsBar from './components/tabs_bar';
import ModalContainer from './containers/modal_container';
import { connect } from 'react-redux';
+import { Redirect, withRouter } from 'react-router-dom';
import { isMobile } from '../../is_mobile';
import { debounce } from 'lodash';
import { uploadCompose } from '../../actions/compose';
});
@connect(mapStateToProps)
+@withRouter
export default class UI extends React.PureComponent {
static contextTypes = {
children: PropTypes.node,
systemFontUi: PropTypes.bool,
isComposing: PropTypes.bool,
+ location: PropTypes.object,
};
state = {
return true;
}
+ componentDidUpdate (prevProps) {
+ if (![this.props.location.pathname, '/'].includes(prevProps.location.pathname)) {
+ this.columnsAreaNode.handleChildrenContentChange();
+ }
+ }
+
componentWillUnmount () {
window.removeEventListener('resize', this.handleResize);
document.removeEventListener('dragenter', this.handleDragEnter);
this.node = c;
}
+ setColumnsAreaRef = (c) => {
+ this.columnsAreaNode = c.getWrappedInstance().getWrappedInstance();
+ }
+
render () {
const { width, draggingOver } = this.state;
const { children } = this.props;
return (
<div className={className} ref={this.setRef}>
<TabsBar />
- <ColumnsAreaContainer singleColumn={isMobile(width)}>
+ <ColumnsAreaContainer ref={this.setColumnsAreaRef} singleColumn={isMobile(width)}>
<WrappedSwitch>
<Redirect from='/' to='/getting-started' exact />
<WrappedRoute path='/getting-started' component={GettingStarted} content={children} />