Use ES Class Fields & Static Properties (#3008)
Use ES Class Fields & Static Properties (currently stage 2) for improve class outlook. Added babel-plugin-transform-class-properties as a Babel plugin.
This commit is contained in:
parent
44a3584e2d
commit
2991a7cfe6
79 changed files with 838 additions and 1128 deletions
|
@ -40,28 +40,26 @@ let EmojiPicker; // load asynchronously
|
|||
|
||||
class EmojiPickerDropdown extends React.PureComponent {
|
||||
|
||||
constructor (props, context) {
|
||||
super(props, context);
|
||||
this.setRef = this.setRef.bind(this);
|
||||
this.handleChange = this.handleChange.bind(this);
|
||||
this.onHideDropdown = this.onHideDropdown.bind(this);
|
||||
this.onShowDropdown = this.onShowDropdown.bind(this);
|
||||
this.state = {
|
||||
active: false,
|
||||
loading: false
|
||||
};
|
||||
}
|
||||
static propTypes = {
|
||||
intl: PropTypes.object.isRequired,
|
||||
onPickEmoji: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
setRef (c) {
|
||||
state = {
|
||||
active: false,
|
||||
loading: false
|
||||
};
|
||||
|
||||
setRef = (c) => {
|
||||
this.dropdown = c;
|
||||
}
|
||||
|
||||
handleChange (data) {
|
||||
handleChange = (data) => {
|
||||
this.dropdown.hide();
|
||||
this.props.onPickEmoji(data);
|
||||
}
|
||||
|
||||
onShowDropdown () {
|
||||
onShowDropdown = () => {
|
||||
this.setState({active: true});
|
||||
if (!EmojiPicker) {
|
||||
this.setState({loading: true});
|
||||
|
@ -75,7 +73,7 @@ class EmojiPickerDropdown extends React.PureComponent {
|
|||
}
|
||||
}
|
||||
|
||||
onHideDropdown () {
|
||||
onHideDropdown = () => {
|
||||
this.setState({active: false});
|
||||
}
|
||||
|
||||
|
@ -138,9 +136,4 @@ class EmojiPickerDropdown extends React.PureComponent {
|
|||
|
||||
}
|
||||
|
||||
EmojiPickerDropdown.propTypes = {
|
||||
intl: PropTypes.object.isRequired,
|
||||
onPickEmoji: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default injectIntl(EmojiPickerDropdown);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue