Gathering detailed insights and metrics for react-native-search-header
Gathering detailed insights and metrics for react-native-search-header
Gathering detailed insights and metrics for react-native-search-header
Gathering detailed insights and metrics for react-native-search-header
react-native-search-header-box
Hii, search header bar
react-native-header-search-bar
Fully customizable header search bar for React Native
react-native-header-search-bar-custom
Fully customizable header search bar for React Native
expo-header-search-paths
Automatically fix Header Search Paths in React Native modules
Easy to use React Native search header component based on material design patterns.
npm install react-native-search-header
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
192 Stars
116 Commits
31 Forks
7 Watchers
37 Branches
5 Contributors
Updated on Apr 19, 2025
Latest Version
0.3.5
Package Id
react-native-search-header@0.3.5
Unpacked Size
1.59 MB
Size
1.12 MB
File Count
16
NPM Version
6.9.0
Node Version
10.11.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Easy to use React Native search header component based on material design patterns.
$ npm install react-native-search-header --save
To use search header you simply import the component factory function to create a renderable component:
1import React from 'react'; 2import { 3 Dimensions, 4 AppRegistry, 5 StyleSheet, 6 View, 7 Text, 8 Button, 9 StatusBar 10} from 'react-native'; 11import SearchHeader from 'react-native-search-header'; 12 13const DEVICE_WIDTH = Dimensions.get(`window`).width; 14 15const styles = StyleSheet.create({ 16 container: { 17 flex: 1, 18 justifyContent: 'flex-start', 19 alignItems: 'center', 20 backgroundColor: '#f5fcff' 21 }, 22 status: { 23 zIndex: 10, 24 elevation: 2, 25 width: DEVICE_WIDTH, 26 height: 21, 27 backgroundColor: '#0097a7' 28 }, 29 header: { 30 justifyContent: 'center', 31 alignItems: 'center', 32 width: DEVICE_WIDTH, 33 height: 56, 34 marginBottom: 6, 35 backgroundColor: '#00bcd4' 36 }, 37 label: { 38 flexGrow: 1, 39 fontSize: 20, 40 fontWeight: `600`, 41 textAlign: `left`, 42 marginVertical: 8, 43 paddingVertical: 3, 44 color: `#f5fcff`, 45 backgroundColor: `transparent` 46 }, 47 button: { 48 justifyContent: 'center', 49 alignItems: 'center', 50 width: 130, 51 height: 40, 52 marginTop: 40, 53 borderRadius: 2, 54 backgroundColor: `#ff5722` 55 } 56}); 57 58const Demo = () => { 59 const searchHeaderRef = React.useRef(null); 60 return ( 61 <View style = { styles.container }> 62 <StatusBar barStyle = 'light-content' /> 63 <View style = { styles.status }/> 64 <View style = { styles.header }> 65 <Text style = { styles.label }> Demo </Text> 66 <Button 67 title = 'Search' 68 color = '#f5fcff' 69 onPress = {() => searchHeaderRef.current.show()} 70 /> 71 </View> 72 <SearchHeader 73 ref = { searchHeaderRef } 74 placeholder = 'Search...' 75 placeholderColor = 'gray' 76 pinnedSuggestions = {[ `react-native-search-header`, `react-native`, `javascript` ]} 77 onClear = {() => { 78 console.log(`Clearing input!`); 79 }} 80 onGetAutocompletions = {async (text) => { 81 if (text) { 82 const response = await fetch(`http://suggestqueries.google.com/complete/search?client=firefox&q=${text}`, { 83 method: `get` 84 }); 85 const data = await response.json(); 86 return data[1]; 87 } else { 88 return []; 89 } 90 }} 91 /> 92 <View style = { styles.button }> 93 <Button 94 title = 'Open Search' 95 color = '#f5fcff' 96 onPress = {() => searchHeaderRef.current.show()} 97 /> 98 </View> 99 <View style = { styles.button }> 100 <Button 101 title = 'Clear' 102 color = '#f5fcff' 103 onPress = {() => { 104 searchHeaderRef.current.clear(); 105 }} 106 /> 107 </View> 108 </View> 109 ); 110} 111 112AppRegistry.registerComponent('Demo', () => Demo);
These are methods that are accessible via "ref":
Methods | description |
---|---|
isHidden | Call to check if the SearchHeader is visible. |
show | Call to show the SearchHeader. |
hide | Call to hide the SearchHeader. |
clear | Call to clear the SearchHeader text input. |
clearSuggestion | Call to clear search suggestion list. |
Below are the props you can pass to the React Component to customize the SearchHeader.
Prop | Type | Default | description |
---|---|---|---|
headerHeight | string | #5d5d5d | Custom header bar height |
headerBgColor | string | #5d5d5d | Custom header background color |
inputColor | string | #5d5d5d | Search text input color |
inputBgColor | string | transparent | Search text input background color |
placeholderColor | string | #bdbdbd | Text input placeholder color |
suggestionEntryColor | string | #bdbdbd | Search suggestion text color |
iconColor | string | #5d5d5d | SearchHeader component icon button color |
topOffset | number | 24 | The offset above the SearchHeader component. Default to 24 (ios) or 0 (android) |
dropShadowed | boolean | true | Enable drop shadow styling |
visibleInitially | boolean | false | Set to false to hide and to true to show the SearchHeader component |
autoFocus | boolean | true | Enable text input auto focus when open |
autoCorrect | boolean | true | Enable text input autocorrect |
persistent | boolean | false | Enable persistent search |
enableSuggestion | boolean | true | When enabled, search suggestion list will be display accordingly |
suggestionHistoryEntryRollOverCount | number | 16 | The max number of search suggestion history items |
pinnedSuggestions | array | [] | An array of pinned search suggestions |
placeholder | string | Search... | A string placeholder when there is no text in text input |
entryAnimation | string | from-left-side | Set the direction of SearchHeader entry animation. Possible values are from-left-side , from-right-side |
iconImageComponents: | function | Internal | An array of custom icon image components for the buttons |
onGetAutocompletions | function | None | This function is called during search input change to get a string array of search autocompletions |
onClear | function | None | This function is called when text input is cleared |
onSearch | function | None | This function is called after return/done key is pressed. Return text input event |
onEnteringSearch | function | None | This function is called after text is entered/changed in text input. Return text input event |
onFocus | function | None | This function is called when text input in focused |
onBlur | function | None | This function is called when text input in blurred |
onHide | function | None | This function is called right after hide animation is completed |
onShow | function | None | This function is called right after show animation is completed |
SearchHeader component default style can be override. Below are examples of how to override each default style element.
1<SearchHeader 2 style = {{ 3 container: { 4 ...myContainerStyle 5 }, 6 header: { 7 ...mySearchHeaderStyle 8 }, 9 suggestion: { 10 ...mySearchSuggestionStyle 11 }, 12 input: { 13 ...mySearchInputTextStyle 14 }, 15 suggestionEntry: { 16 ...mySearchSuggestionEntryTextStyle 17 }, 18 icon: { 19 ...myIconStyle 20 } 21 }} 22/>
Release Version 0.3.5 (09/09/2019)
Notes:
New Features:
- Added support for new React Hooks.
Breaking Changes:
Improvements:
- When enableSuggestion = true, suggestion view is visible when text input is focused and hidden when text input is blurred.
- Removed componentDidUpdate for SearchHeaderWithReactClass.
Bug fixes:
Release Version 0.3.4 (07/03/2019)
Notes:
New Features:
Breaking Changes:
Improvements:
Bug fixes:
- Fixed a bug where hidden suggestion view is blocking other components from receiving touch events.
Release Version 0.3.3 (07/02/2019)
Notes:
New Features:
- Added pin search entry suggestions
- Updated dependencies to latest
Breaking Changes:
Improvements:
- Changed suggestion visibility. It is now visible when search input is focused and hidden when blurred
- Code cleanups
Bug fixes:
- Fixed history suggestion entry rollover
- Fixed misc suggestion view issues
Release Version 0.3.2 (03/11/2019)
Notes:
New Features:
Breaking Changes:
Improvements:
- Removed lodash dependency
- Code cleanups
- Fixed animations
- Changed suggestion view style
Bug fixes:
Release Version 0.3.1 (01/28/2019)
Notes:
New Features:
Breaking Changes:
Improvements:
Bug fixes:
- Fixed style not overriding bug. #28, #30
Release Version 0.3.0 (11/13/2018)
Notes:
Updated compatibility to latest react native version 0.57
New Features:
Breaking Changes:
Improvements:
- Improved icon image components implementation.
Bug fixes:
- Fixed minor bugs for input placeholder.
Release Version 0.2.9 (09/10/2018)
Notes:
New Features:
Breaking Changes:
Improvements:
- Updated lifecycle methods called to match latest react recommendations.
Bug fixes:
- Fixed TextInput lag issue.
Release Version 0.2.8 (08/30/2018)
Notes:
Updated compatibility to latest react native version 0.56
New Features:
Breaking Changes:
Improvements:
Bug fixes:
- Fixed suggestion text display to have tail ellipsize if there are too many words in one line.
- Fixed text input clearing issue.
Release Version 0.2.7 (04/09/2018)
Notes:
Updated compatibility to latest react native version 0.55.4
New Features:
- Added onClear callback when text input is cleared
Breaking Changes:
Improvements:
Bug fixes:
- Add note to get clear method to work with react native 55.4.
- Fixed no spacing for text entry in search suggestion box view.
Release Version 0.2.6 (03/19/2018)
Notes:
Updated compatibility to latest react native version 0.54.2
New Features:
Breaking Changes:
Improvements:
Bug fixes:
- Fixed bug where clearing text input or if text input is empty will not close the suggestion view
- Fixed documentation in README
onHidden -> onHide
onVisible -> onShow
Release Version 0.2.5 (02/05/2018)
Notes:
Updated compatibility to latest react native version 0.53.0
New Features:
Added onClearSuggesstion callback prop to clear suggestion history
Breaking Changes:
Improvements:
Bug fixes:
- Fixed topOffset spelling error.
- Fixed key index warning in FlatList.
Release Version 0.2.4 (12/27/2017)
Notes:
New Features:
Added headerHeight prop
Added headerBgColor prop
Breaking Changes:
Improvements:
Bug fixes:
Release Version 0.2.3 (11/26/2017)
Notes:
New Features:
Breaking Changes:
Improvements:
Bug fixes:
- Drop custom deepMerge in favor of lodash.merge
Release Version 0.2.2 (11/25/2017)
Notes:
- Updated to latest React Native version 0.50.4
- Removed Hyperflow dependency as it is not needed.
New Features:
Breaking Changes:
Improvements:
Bug fixes:
- Resolving babel transform error. Hopefully...
Release Version 0.2.1 (10/17/2017)
Notes:
- Updated to latest React Native version
New Features:
- Added persistent search bar
- iconImageComponents prop for easy custom button styling
Breaking Changes:
- No longer needed to do this const SearchHeaderView = SearchHeaderComponent()
Just import and use as any react native component.
- Renaming properties:
searchInputTextColor -> inputColor
placeholderTextColor -> placeholderColor
searchSuggestionTextColor -> suggestionEntryColor
statusHeightOffet -> topOffset
searchSuggestionHistoryItemRollOverCount ->suggestionHistoryEntryRollOverCount
dropShadow -> dropShadowed
enableSearchSuggestion -> enableSuggestion
onGetSearchAutocompletions -> onGetAutocompletions
onSearchChange -> onEnteringSearch
onHidden -> onHid
onVisible -> onShow
Improvements:
Bug fixes:
Release Version 0.2.0 (09/08/2017)
Notes:
- Updated to latest React Native
- updated to latest Hyperflow
New Features:
Breaking Changes:
Improvements:
- Added autoFocus prop
Bug fixes:
- Fixed FlatList missing list item "key" warning
Release Version 0.1.9 (05/27/2017)
Notes:
- Updated to latest React Native
New Features:
Breaking Changes:
Improvements:
- Used FlatList instead of ScrollView to render search suggestion list
Bug fixes:
- Fixed clearSearchSuggestion bug
Release Version 0.1.8 (05/17/2017)
Notes:
New Features:
Breaking Changes:
- Renamed property searchSuggestionItemRollOverCount to searchSuggestionHistoryItemRollOverCount
- Renamed property onGetSearchSuggestions to onGetSearchAutocompletions
Improvements:
- Improved onGetSearchAutocompletions implementation
- Added onGetSearchAutocompletions to example
Bug fixes:
Release Version 0.1.7 (05/10/2017)
Notes:
- Updated package dependencies.
New Features:
Breaking Changes:
Improvements:
Bug fixes:
Release Version 0.1.6 (02/16/2017)
Notes:
New Features:
- Added isHidden and clear methods, accessible via "ref"
Breaking Changes:
Improvements:
Bug fixes:
- Fixed issues with onHidden and onVisible not firing.
Release Version 0.1.5 (01/27/2017)
Notes:
New Features:
Breaking Changes:
Improvements:
- Improved search suggestion implementation. Matching it closer to other material design search implementations.
Bug fixes:
Release Version 0.1.4 (01/26/2017)
Notes:
- Update to latest hyperflow version.
New Features:
- New prop "entryAnimation" for setting SearchHeader entry animation direction.
Breaking Changes:
Improvements:
- Added public methods access via "ref"
Bug fixes:
- Fixed react "refs" warning message.
Release Version 0.1.3 (01/25/2017)
Notes:
- Update to latest hyperflow version.
New Features:
Breaking Changes:
- Props renaming:
searchTextColor -> searchInputTextColor
searchSuggestionItemTextColor -> searchSuggestionTextColor
searchVisibleInitially -> visibleInitially
onSearchBlur -> onBlur
onSearchFocus -> onFocus
onMinimized -> onHidden
onMaximized -> onVisible
Improvements:
- Added public methods access via "ref"
Bug fixes:
- Fixed issue with search container covering underlining components when hidden.
Release Version 0.1.2 (01/23/2017)
Notes:
- Update to latest hyperflow version.
New Features:
Breaking Changes:
- Props renaming:
statusBarHeightOffet -> statusHeightOffet
textInputPlaceholderColor -> placeholderTextColor
minimized -> searchVisibleInitially
onBlur -> onSearchBlur
onFocus -> onSearchFocus
onMinimized -> onSearchHidden
onMaximized -> onSearchVisible
Improvements:
- Added public methods access via "ref"
Bug fixes:
Release Version 0.1.1 (01/23/2017)
Notes:
- Update to latest hyperflow version.
New Features:
Breaking Changes:
Improvements:
Bug fixes:
Release Version 0.1.0 (01/22/2017)
Notes:
- Initial commit with features
Search header component based on material design.
Search suggestions and history with autocomplete. patterns
New Features:
Breaking Changes:
Improvements:
Bug fixes:
No vulnerabilities found.
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/27 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
74 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More