@@ -280,17 +280,23 @@ export default class PostsView extends React.Component {
|
|||||||
this.updateScrolling();
|
this.updateScrolling();
|
||||||
}
|
}
|
||||||
window.addEventListener('resize', this.handleResize);
|
window.addEventListener('resize', this.handleResize);
|
||||||
PreferenceStore.addChangeListener(this.updateState);
|
|
||||||
}
|
}
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
window.removeEventListener('resize', this.handleResize);
|
window.removeEventListener('resize', this.handleResize);
|
||||||
PreferenceStore.removeChangeListener(this.updateState);
|
|
||||||
}
|
}
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
if (this.props.postList != null) {
|
if (this.props.postList != null) {
|
||||||
this.updateScrolling();
|
this.updateScrolling();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
if (!this.props.isActive && nextProps.isActive) {
|
||||||
|
this.updateState();
|
||||||
|
PreferenceStore.addChangeListener(this.updateState);
|
||||||
|
} else if (this.props.isActive && !nextProps.isActive) {
|
||||||
|
PreferenceStore.removeChangeListener(this.updateState);
|
||||||
|
}
|
||||||
|
}
|
||||||
shouldComponentUpdate(nextProps, nextState) {
|
shouldComponentUpdate(nextProps, nextState) {
|
||||||
if (this.props.isActive !== nextProps.isActive) {
|
if (this.props.isActive !== nextProps.isActive) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user