Give react callbacks underscores too
This commit is contained in:
parent
2dd0165bfc
commit
9333f91533
1 changed files with 14 additions and 14 deletions
|
@ -20,11 +20,11 @@ import classnames from 'classnames';
|
||||||
export default class DirectorySearchBox extends React.Component {
|
export default class DirectorySearchBox extends React.Component {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.collectInput = this.collectInput.bind(this);
|
this._collectInput = this._collectInput.bind(this);
|
||||||
this.onClearClick = this.onClearClick.bind(this);
|
this._onClearClick = this._onClearClick.bind(this);
|
||||||
this.onChange = this.onChange.bind(this);
|
this._onChange = this._onChange.bind(this);
|
||||||
this.onKeyUp = this.onKeyUp.bind(this);
|
this._onKeyUp = this._onKeyUp.bind(this);
|
||||||
this.onJoinButtonClick = this.onJoinButtonClick.bind(this);
|
this._onJoinButtonClick = this._onJoinButtonClick.bind(this);
|
||||||
|
|
||||||
this.input = null;
|
this.input = null;
|
||||||
|
|
||||||
|
@ -33,11 +33,11 @@ export default class DirectorySearchBox extends React.Component {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
collectInput(e) {
|
_collectInput(e) {
|
||||||
this.input = e;
|
this.input = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
onClearClick() {
|
_onClearClick() {
|
||||||
this.setState({value: ''});
|
this.setState({value: ''});
|
||||||
|
|
||||||
if (this.input) {
|
if (this.input) {
|
||||||
|
@ -49,7 +49,7 @@ export default class DirectorySearchBox extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onChange(ev) {
|
_onChange(ev) {
|
||||||
if (!this.input) return;
|
if (!this.input) return;
|
||||||
this.setState({value: ev.target.value});
|
this.setState({value: ev.target.value});
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ export default class DirectorySearchBox extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyUp(ev) {
|
_onKeyUp(ev) {
|
||||||
if (ev.key == 'Enter') {
|
if (ev.key == 'Enter') {
|
||||||
if (this.props.onJoinClick) {
|
if (this.props.onJoinClick) {
|
||||||
this.props.onJoinClick(this.state.value);
|
this.props.onJoinClick(this.state.value);
|
||||||
|
@ -66,7 +66,7 @@ export default class DirectorySearchBox extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onJoinButtonClick() {
|
_onJoinButtonClick() {
|
||||||
if (this.props.onJoinClick) {
|
if (this.props.onJoinClick) {
|
||||||
this.props.onJoinClick(this.state.value);
|
this.props.onJoinClick(this.state.value);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ export default class DirectorySearchBox extends React.Component {
|
||||||
let join_button;
|
let join_button;
|
||||||
if (this._contentLooksLikeAlias()) {
|
if (this._contentLooksLikeAlias()) {
|
||||||
join_button = <span className="mx_DirectorySearchBox_joinButton"
|
join_button = <span className="mx_DirectorySearchBox_joinButton"
|
||||||
onClick={this.onJoinButtonClick}
|
onClick={this._onJoinButtonClick}
|
||||||
>
|
>
|
||||||
Join
|
Join
|
||||||
</span>;
|
</span>;
|
||||||
|
@ -98,13 +98,13 @@ export default class DirectorySearchBox extends React.Component {
|
||||||
<div className="mx_DirectorySearchBox_container">
|
<div className="mx_DirectorySearchBox_container">
|
||||||
<input type="text" value={this.state.value}
|
<input type="text" value={this.state.value}
|
||||||
className="mx_DirectorySearchBox_input"
|
className="mx_DirectorySearchBox_input"
|
||||||
ref={this.collectInput}
|
ref={this._collectInput}
|
||||||
onChange={this.onChange} onKeyUp={this.onKeyUp}
|
onChange={this._onChange} onKeyUp={this._onKeyUp}
|
||||||
placeholder="Find a room by keyword or room ID (#matrix:matrix.org)"
|
placeholder="Find a room by keyword or room ID (#matrix:matrix.org)"
|
||||||
/>
|
/>
|
||||||
{join_button}
|
{join_button}
|
||||||
<span className="mx_DirectorySearchBox_clear_wrapper">
|
<span className="mx_DirectorySearchBox_clear_wrapper">
|
||||||
<span className="mx_DirectorySearchBox_clear" onClick={this.onClearClick} />
|
<span className="mx_DirectorySearchBox_clear" onClick={this._onClearClick} />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</span>;
|
</span>;
|
||||||
|
|
Loading…
Reference in a new issue