Fixed SuggestionLists to properly hide when the textbox loses focus
Этот коммит содержится в:
@@ -35,7 +35,7 @@ export default class SearchSuggestionList extends SuggestionList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.state.items.length === 0) {
|
if (this.state.items.length === 0 || !this.props.show) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,5 +82,5 @@ export default class SearchSuggestionList extends SuggestionList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SearchSuggestionList.propTypes = {
|
SearchSuggestionList.propTypes = {
|
||||||
suggestionId: React.PropTypes.string.isRequired
|
...SuggestionList.propTypes
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -147,8 +147,6 @@ export default class SuggestionBox extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const SuggestionList = this.props.listComponent;
|
|
||||||
|
|
||||||
const newProps = Object.assign({}, this.props, {
|
const newProps = Object.assign({}, this.props, {
|
||||||
onFocus: this.handleFocus,
|
onFocus: this.handleFocus,
|
||||||
onChange: this.handleChange,
|
onChange: this.handleChange,
|
||||||
@@ -173,10 +171,15 @@ export default class SuggestionBox extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SuggestionListComponent = this.props.listComponent;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{textbox}
|
{textbox}
|
||||||
<SuggestionList suggestionId={this.suggestionId} />
|
<SuggestionListComponent
|
||||||
|
suggestionId={this.suggestionId}
|
||||||
|
show={this.state.focused}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ export default class SuggestionList extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.state.items.length === 0) {
|
if (this.state.items.length === 0 || !this.props.show) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,5 +125,6 @@ export default class SuggestionList extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SuggestionList.propTypes = {
|
SuggestionList.propTypes = {
|
||||||
suggestionId: React.PropTypes.string.isRequired
|
suggestionId: React.PropTypes.string.isRequired,
|
||||||
|
show: React.PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user