SearchBar

SearchBar is a simple input box where users can type search queries.

Usage

export default class MyComponent extends Component {
  state = {
    firstQuery: '',
  };

  render() {
    const { firstQuery } = this.state;
    return (
      <SearchBar
        placeholder="Search"
        onChangeText={query => { this.setState({ firstQuery: query }); }}
        value={firstQuery}
      />
    );
  }
}

Props

placeholder
Type: string

Hint text shown when the input is empty.

value (required)
Type: string

The value of the text input.

icon
Type: IconSource

Icon name for the left icon button (see onIconPress).

onChangeText (required)
Type: (query: string) => void

Callback that is called when the text input's text changes.

onIconPress
Type: Function

Callback to execute if we want the left icon to act as button.

style
Type: any
theme
Type: Theme