Browse Source

Bump react version

pull/6/head
Casper Lamboo 1 year ago
parent
commit
1a5f0fd9d0
  1. 37242
      package-lock.json
  2. 2
      package.json
  3. 32
      src/components/App.js

37242
package-lock.json generated

File diff suppressed because it is too large Load Diff

2
package.json

@ -40,7 +40,7 @@
"proptypes": "^1.1.0",
"raf": "^3.4.0",
"ramda": "^0.21.0",
"react": "^16.0.0",
"react": "^16.0.1",
"react-addons-update": "^15.6.2",
"react-jss": "^7.0.2",
"react-notification-system-redux": "^1.2.0",

32
src/components/App.js

@ -79,27 +79,35 @@ class App extends React.Component {
preventScroll: PropTypes.bool.isRequired
};
constructor(props) {
super(props);
this.container = React.createRef();
}
state = {
loaded: isLoaded()
};
componentDidMount() {
const { container } = this.refs;
if (!this.state.loaded) load.then(() => this.setState({ loaded: true }));
container.addEventListener('dragover', this.dragOver);
container.addEventListener('drop', this.onDrop);
container.addEventListener('wheel', this.onWheel);
window.addEventListener('keydown', this.onKeyDown);
if (this.container.current) {
this.container.current.addEventListener('dragover', this.dragOver);
this.container.current.addEventListener('drop', this.onDrop);
this.container.current.addEventListener('wheel', this.onWheel);
window.addEventListener('keydown', this.onKeyDown);
}
}
componentWillUnmount() {
const { container } = this.refs;
container.addEventListener('dragover', this.dragOver);
container.removeEventListener('drop', this.onDrop);
container.addEventListener('wheel', this.onWheel);
window.removeEventListener('keydown', this.onKeyDown);
if (this.container.current) {
this.container.current.addEventListener('dragover', this.dragOver);
this.container.current.removeEventListener('drop', this.onDrop);
this.container.current.addEventListener('wheel', this.onWheel);
window.removeEventListener('keydown', this.onKeyDown);
}
}
dragOver = event => {
@ -232,7 +240,7 @@ class App extends React.Component {
const { loaded } = this.state;
return (
<div ref="container" className={classes.container}>
<div ref={this.container} className={classes.container}>
<InlineIconsLoader />
{loaded && <div className={classes.appContainer}>
<D2Panel />

Loading…
Cancel
Save