English | Tiếng Việt
An animated, iOS-style search bar for React Native. No dependencies, no native code. iOS, Android and web, with TypeScript types.
Documentation with live demos and copyable code →
![]() Filter a list |
![]() Live search |
![]() Contacts |
![]() Recent searches |
![]() In a header |
![]() Themed |
Also: playground, hide on scroll, minimal, right to left.
npm install react-native-search-boxWorks in Expo Go, needs no linking. React 16.8 and React Native 0.60 or later.
import { useState } from 'react';
import { FlatList, Text, View } from 'react-native';
import Search from 'react-native-search-box';
const cities = ['Berlin', 'Hà Nội', 'Paris', 'Tokyo'];
export default function App() {
const [query, setQuery] = useState('');
return (
<View style={{ flex: 1 }}>
<Search value={query} onChangeText={setQuery} />
<FlatList
data={cities.filter((city) => city.toLowerCase().includes(query.toLowerCase()))}
keyboardShouldPersistTaps="handled"
renderItem={({ item }) => <Text style={{ padding: 16 }}>{item}</Text>}
keyExtractor={(city) => city}
/>
</View>
);
}<Search searchDelay={350} onSearch={async (text) => setResults(await api.search(text))} /><Search placeholderAlign="left" showCancelButton={false} animated={false} /><View style={{ flexDirection: 'row' }}>
<Avatar />
<Search containerStyle={{ flex: 1 }} />
</View>const box = useRef<Search>(null);
await box.current?.focus('shoes');
await box.current?.search();| Group | Props |
|---|---|
| Text | value defaultValue placeholder cancelTitle autoFocus editable textInputProps |
| Behavior | searchDelay showCancelButton useClearButton collapseOnBlur keyboardShouldPersist placeholderAlign animated animationDuration direction |
| Callback | onChangeText onSearch onFocus onBlur onDelete onCancel (with before* / after*) |
| Style | containerStyle inputStyle inputHeight backgroundColor iconSearch iconDelete … |
| Testing | testID inputTestID cancelButtonTestID clearButtonTestID |
Full reference: props, methods.
Props, defaults and ref methods are kept. A few behaviors changed, see Migration and the changelog.





