Keyboard disappears in searchbar component
See original GitHub issueHi,
I’m using version 1.2.4 SearchBar component but when i use it in android device the keyboard disappears after every key input!
here is my code:
const [searchBrand, setSearchBrand] = useState('');
const searchFilterFunction = text => { setSearchBrand(text); };
const renderHeader = () => { return ( <SearchBar placeholder="Type Here..." onChangeText={searchFilterFunction} value={searchBrand} /> ); };
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
Keyboard disappearing after each key press in a SearchBar?
Just some general direction. You need some form of debouncing. Either find a search component that has that or implemented your own.
Read more >React Native: Searchbar disappears after typing one single letter
The SearchBar now lets only type one single letter, then the keyboard disappears and you have to click the input field again to...
Read more >Keyboard missing in App Libray search bar…
Tap once in the search bar, you will see the keyboard. When you scroll, the keyboard disappears. Then tap on an app you...
Read more >Google search bar widget closes keyboard after typing one letter
Tap on the Google Search widget, the widget opens the search screen, keyboard automatically appears allowing me to type. However, immediately ...
Read more >React Native — SearchBar in FlatList loses focus after typing
The problem I encountered is that after typing one character the search bar loses focus and the keyboard disappears — it's almost like...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thank you, the issue caused because i used <SearchBar> inside Flatlist headercomponent prop
<FlatList ListHeaderComponent={renderHeader}.....but when i used it outside the component it works properly.
<View style={styles.container}> <SearchBar placeholder="Type Here..." onChangeText={searchFilterFunction} value={searchBrand} clearIcon={null} /> <FlatList data={brandsData} renderItem={({item}) => <RenderSingleItem item={item} />} /> </View>It still doesn’t work if SearchBar is added to the Header of the FlatList example:
` const [search, setSearch] = useState(“”);