More componentWillUpdate transition fixes.

This commit is contained in:
orangemug
2018-08-07 20:13:45 +01:00
parent 1aa90bef37
commit 409f81f0d8
2 changed files with 15 additions and 8 deletions

View File

@@ -62,18 +62,23 @@ export default class ZoomProperty extends React.Component {
}
componentDidMount() {
this.setState({
refs: setStopRefs(this.props, this.state)
})
const newRefs = setStopRefs(this.props, this.state);
if(newRefs) {
this.setState({
refs: newRefs
})
}
}
static getDerivedStateFromProps(nextProps) {
static getDerivedStateFromProps(props, state) {
const newRefs = setStopRefs(props, state);
if(newRefs) {
return {
refs: newRefs
};
}
return null;
}
// Order the stops altering the refs to reflect their new position.