Read custom search bar react native for more information.
React Native provides a search bar through the react-native-elements library. Import SearchBar from ‘react-native-elements’, keep the input value in component state, and update it with onChangeText. The SearchBar accepts a placeholder prop, and the component renders a customizable search input.
SearchBars are used to search or filter items. Use a SearchBar when the number of items directly impacts a user’s ability to find one of them. React native provides search bar from react-native-elements.

Build a fully customizable Search without any coding
Basic React Native SearchBar example
You can use the following code to make a search bar in react native.
import { SearchBar } from 'react-native-elements';
export default class App extends React.Component {
state = {
search: '',
};
updateSearch = search => {
this.setState({ search });
};
render() {
const { search } = this.state;
return (
<SearchBar
placeholder="Type Here..."
onChangeText={this.updateSearch}
value={search}
/>
);
}
}
Customize the search bar
The example above uses three props of the SearchBar component:
| Prop | Purpose |
|---|---|
| placeholder | Sets hint text (the example uses “Type Here…”) |
| onChangeText | Handles text changes (updateSearch) |
| value | Controlled input value (search state) |
Filter a list with the search bar
Use the search state from the SearchBar example to filter your items as the user types. Each time the text changes, updateSearch stores the new value in state, so you can use that value to decide which items to show.
When to use a SearchBar
- Use a SearchBar when the number of items directly impacts a user’s ability to find one of them.
- SearchBars are used to search or filter items.




