Fix layout of clear icon

Summary:
Flipper clear icon was hidden, this fixes it

Also fixed a null pointer exception that would occur when clearing search with the keyboard, and no filters were active

Reviewed By: passy

Differential Revision: D19445833

fbshipit-source-id: 213c28dc8c1e295018e6318f86604d96d2a9b75c
This commit is contained in:
Michel Weststrate
2020-01-17 06:28:38 -08:00
committed by Facebook Github Bot
parent ef0cf87448
commit c8ebb7caaf

View File

@@ -291,6 +291,7 @@ const Searchable = (
this.state.focusedToken === -1 &&
this.state.searchTerm === '' &&
this._inputRef &&
lastFilter &&
(lastFilter.type !== 'enum' || !lastFilter.persistent)
) {
this._inputRef.blur();
@@ -483,6 +484,9 @@ const Searchable = (
}
regex={Boolean(this.state.regexEnabled && this.state.searchTerm)}
/>
{(this.state.searchTerm || this.state.filters.length > 0) && (
<Clear onClick={this.clear}>&times;</Clear>
)}
</SearchBox>
{this.props.allowRegexSearch ? (
<ToggleButton
@@ -501,9 +505,6 @@ const Searchable = (
}
/>
) : null}
{(this.state.searchTerm || this.state.filters.length > 0) && (
<Clear onClick={this.clear}>&times;</Clear>
)}
{actions != null && <Actions>{actions}</Actions>}
</SearchBar>,
<Component