Minor renaming
This commit is contained in:
parent
b29bb21d34
commit
724fc68e00
|
@ -1,17 +1,18 @@
|
|||
import React, { Component } from 'react';
|
||||
|
||||
export default class WrappedWidget extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.element = React.createRef();
|
||||
}
|
||||
|
||||
updateWidget(props) {
|
||||
renderWidget(props) {
|
||||
const widgetEl = this.props.widget({
|
||||
annotation: props.annotation,
|
||||
readOnly: props.readOnly,
|
||||
...this.props.config,
|
||||
...props.config,
|
||||
onAppendBody: body => props.onAppendBody(body),
|
||||
onUpdateBody: (previous, updated) => props.onUpdateBody(previous, updated),
|
||||
onRemoveBody: body => props.onRemoveBody(body),
|
||||
|
@ -26,13 +27,13 @@ export default class WrappedWidget extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.updateWidget(this.props);
|
||||
this.renderWidget(this.props);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(next) {
|
||||
if (this.element.current) {
|
||||
if (this.props.annotation !== next.annotation) {
|
||||
this.updateWidget(next);
|
||||
this.renderWidget(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue