Fixing resize
Этот коммит содержится в:
@@ -9,6 +9,7 @@ export default class ErrorBar extends React.Component {
|
|||||||
|
|
||||||
this.onErrorChange = this.onErrorChange.bind(this);
|
this.onErrorChange = this.onErrorChange.bind(this);
|
||||||
this.handleClose = this.handleClose.bind(this);
|
this.handleClose = this.handleClose.bind(this);
|
||||||
|
this.resize = this.resize.bind(this);
|
||||||
this.prevTimer = null;
|
this.prevTimer = null;
|
||||||
|
|
||||||
this.state = ErrorStore.getLastError();
|
this.state = ErrorStore.getLastError();
|
||||||
@@ -45,26 +46,8 @@ export default class ErrorBar extends React.Component {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
resize() {
|
||||||
ErrorStore.addChangeListener(this.onErrorChange);
|
if (this.isValidError(this.state)) {
|
||||||
|
|
||||||
$(window).resize(() => {
|
|
||||||
if (this.isValidError(this.state)) {
|
|
||||||
var height = $(React.findDOMNode(this)).outerHeight();
|
|
||||||
height = height < 30 ? 30 : height;
|
|
||||||
$('body').css('padding-top', height + 'px');
|
|
||||||
} else {
|
|
||||||
$('body').css('padding-top', '0');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
ErrorStore.removeChangeListener(this.onErrorChange);
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(nextProps, nextState) {
|
|
||||||
if (this.isValidError(nextState)) {
|
|
||||||
var height = $(React.findDOMNode(this)).outerHeight();
|
var height = $(React.findDOMNode(this)).outerHeight();
|
||||||
height = height < 30 ? 30 : height;
|
height = height < 30 ? 30 : height;
|
||||||
$('body').css('padding-top', height + 'px');
|
$('body').css('padding-top', height + 'px');
|
||||||
@@ -73,6 +56,24 @@ export default class ErrorBar extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
ErrorStore.addChangeListener(this.onErrorChange);
|
||||||
|
|
||||||
|
$(window).resize(() => {
|
||||||
|
this.resize();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.resize();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
ErrorStore.removeChangeListener(this.onErrorChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidUpdate() {
|
||||||
|
this.resize();
|
||||||
|
}
|
||||||
|
|
||||||
onErrorChange() {
|
onErrorChange() {
|
||||||
var newState = ErrorStore.getLastError();
|
var newState = ErrorStore.getLastError();
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user