Created
July 14, 2017 10:33
-
-
Save jkomyno/c11544a76fc55dc0a413c33282026943 to your computer and use it in GitHub Desktop.
Platform consistent SearchBar component for react-native
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import SearchBar from 'react-native-material-design-searchbar'; | |
const SearchBar = ({ onChangeText, onBackButtonPress, placeholder }) => ( | |
<SearchBar | |
onSearchChange={onChangeText} | |
placeholder={placeholder} | |
onBackPress={onBackButtonPress} | |
height={50} | |
autoCorrect={false} | |
returnKeyType="search" | |
/> | |
); | |
SearchBar.propTypes = { | |
onChangeText: PropTypes.func.isRequired, | |
onBackButtonPress: PropTypes.func.isRequired, | |
placeholder: PropTypes.string.isRequired, | |
}; | |
export default SearchBar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import SearchBar from 'react-native-search-bar'; | |
const SearchBar = ({ onChangeText, onBackButtonPress, placeholder }) => ( | |
<SearchBar | |
ref="searchBar" | |
placeholder={placeholder} | |
onChangeText={onChangeText} | |
onCancelButtonPress={onBackButtonPress} | |
/> | |
); | |
SearchBar.propTypes = { | |
onChangeText: PropTypes.func.isRequired, | |
onBackButtonPress: PropTypes.func.isRequired, | |
placeholder: PropTypes.string.isRequired, | |
}; | |
export default SearchBar; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment