2018-08-31 18:13:30 +00:00
|
|
|
import React from 'react';
|
2019-03-01 16:49:11 +00:00
|
|
|
import { View, StyleSheet, TextInput } from 'react-native';
|
2018-08-31 18:13:30 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import I18n from '../i18n';
|
2019-01-29 19:52:56 +00:00
|
|
|
import { isIOS } from '../utils/deviceInfo';
|
2019-03-01 16:49:11 +00:00
|
|
|
import { CustomIcon } from '../lib/Icons';
|
2019-03-29 19:36:07 +00:00
|
|
|
import sharedStyles from '../views/Styles';
|
2018-08-31 18:13:30 +00:00
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
container: {
|
2019-01-29 19:52:56 +00:00
|
|
|
backgroundColor: isIOS ? '#F7F8FA' : '#54585E'
|
2018-08-31 18:13:30 +00:00
|
|
|
},
|
|
|
|
searchBox: {
|
|
|
|
alignItems: 'center',
|
|
|
|
backgroundColor: '#E1E5E8',
|
|
|
|
borderRadius: 10,
|
|
|
|
color: '#8E8E93',
|
|
|
|
flexDirection: 'row',
|
|
|
|
fontSize: 17,
|
|
|
|
height: 36,
|
|
|
|
margin: 16,
|
|
|
|
marginVertical: 10,
|
|
|
|
paddingHorizontal: 10
|
|
|
|
},
|
|
|
|
input: {
|
|
|
|
color: '#8E8E93',
|
|
|
|
flex: 1,
|
|
|
|
fontSize: 17,
|
|
|
|
marginLeft: 8,
|
|
|
|
paddingTop: 0,
|
2019-03-29 19:36:07 +00:00
|
|
|
paddingBottom: 0,
|
|
|
|
...sharedStyles.textRegular
|
2018-08-31 18:13:30 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-06-10 16:22:35 +00:00
|
|
|
const SearchBox = ({ onChangeText, onSubmitEditing, testID }) => (
|
2018-08-31 18:13:30 +00:00
|
|
|
<View style={styles.container}>
|
|
|
|
<View style={styles.searchBox}>
|
2019-03-01 16:49:11 +00:00
|
|
|
<CustomIcon name='magnifier' size={14} color='#8E8E93' />
|
2018-08-31 18:13:30 +00:00
|
|
|
<TextInput
|
|
|
|
autoCapitalize='none'
|
|
|
|
autoCorrect={false}
|
|
|
|
blurOnSubmit
|
|
|
|
clearButtonMode='while-editing'
|
|
|
|
placeholder={I18n.t('Search')}
|
|
|
|
returnKeyType='search'
|
|
|
|
style={styles.input}
|
|
|
|
testID={testID}
|
|
|
|
underlineColorAndroid='transparent'
|
|
|
|
onChangeText={onChangeText}
|
2019-06-10 16:22:35 +00:00
|
|
|
onSubmitEditing={onSubmitEditing}
|
2018-08-31 18:13:30 +00:00
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
|
|
|
|
SearchBox.propTypes = {
|
|
|
|
onChangeText: PropTypes.func.isRequired,
|
2019-06-10 16:22:35 +00:00
|
|
|
onSubmitEditing: PropTypes.func,
|
2018-08-31 18:13:30 +00:00
|
|
|
testID: PropTypes.string
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SearchBox;
|