Move code out of deprecated componentWillMount()
> warning: Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details. * Move code with side effects to componentDidMount, and set initial state in the constructor
This commit is contained in:
parent
5a6e0beb53
commit
6a7f6805d9
3 changed files with 14 additions and 19 deletions
|
|
@ -181,7 +181,7 @@ class Config extends React.Component {
|
||||||
this.setState({file_error: reason});
|
this.setState({file_error: reason});
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentDidMount() {
|
||||||
this.getConfig();
|
this.getConfig();
|
||||||
this.readConfig();
|
this.readConfig();
|
||||||
}
|
}
|
||||||
|
|
@ -393,7 +393,7 @@ class SssdConfig extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentDidMount() {
|
||||||
let syntax_object = {
|
let syntax_object = {
|
||||||
parse: ini.parse,
|
parse: ini.parse,
|
||||||
stringify: ini.stringify
|
stringify: ini.stringify
|
||||||
|
|
|
||||||
|
|
@ -697,8 +697,16 @@ export class Player extends React.Component {
|
||||||
cols: 80,
|
cols: 80,
|
||||||
rows: 25,
|
rows: 25,
|
||||||
title: _("Player"),
|
title: _("Player"),
|
||||||
term: null,
|
|
||||||
paused: true,
|
paused: true,
|
||||||
|
/* Terminal */
|
||||||
|
term: new Term({
|
||||||
|
cols: 80,
|
||||||
|
rows: 25,
|
||||||
|
screenKeys: true,
|
||||||
|
useStyle: true,
|
||||||
|
/* Exposes the xterm-accessibility-tree */
|
||||||
|
screenReaderMode: true,
|
||||||
|
}),
|
||||||
/* Speed exponent */
|
/* Speed exponent */
|
||||||
speedExp: 0,
|
speedExp: 0,
|
||||||
scale_initial: 1,
|
scale_initial: 1,
|
||||||
|
|
@ -1149,24 +1157,11 @@ export class Player extends React.Component {
|
||||||
this._transform();
|
this._transform();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentDidMount() {
|
||||||
let term = new Term({
|
this.state.term.on('title', this.handleTitleChange);
|
||||||
cols: this.state.cols,
|
|
||||||
rows: this.state.rows,
|
|
||||||
screenKeys: true,
|
|
||||||
useStyle: true,
|
|
||||||
/* Exposes the xterm-accessibility-tree */
|
|
||||||
screenReaderMode: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
term.on('title', this.handleTitleChange);
|
|
||||||
|
|
||||||
this.setState({ term: term });
|
|
||||||
|
|
||||||
window.addEventListener("keydown", this.handleKeyDown, false);
|
window.addEventListener("keydown", this.handleKeyDown, false);
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
if (this.refs.wrapper.offsetWidth) {
|
if (this.refs.wrapper.offsetWidth) {
|
||||||
this.setState({containerWidth: this.refs.wrapper.offsetWidth});
|
this.setState({containerWidth: this.refs.wrapper.offsetWidth});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -339,7 +339,7 @@ class Logs extends React.Component {
|
||||||
this.getLogs();
|
this.getLogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentDidMount() {
|
||||||
this.getServerTimeOffset();
|
this.getServerTimeOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue