-
Notifications
You must be signed in to change notification settings - Fork 120
/
SearchBox.js
42 lines (38 loc) · 979 Bytes
/
SearchBox.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React from 'react';
import { StyleSheet, View, TextInput } from 'react-native';
import PropTypes from 'prop-types';
import { connectSearchBox } from 'react-instantsearch-native';
const styles = StyleSheet.create({
container: {
padding: 16,
backgroundColor: '#252b33',
},
input: {
height: 48,
padding: 12,
fontSize: 16,
backgroundColor: '#fff',
borderRadius: 4,
borderWidth: 1,
borderColor: '#ddd',
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
shadowRadius: 2,
},
});
const SearchBox = ({ currentRefinement, refine }) => (
<View style={styles.container}>
<TextInput
style={styles.input}
onChangeText={value => refine(value)}
value={currentRefinement}
placeholder=""
/>
</View>
);
SearchBox.propTypes = {
currentRefinement: PropTypes.string.isRequired,
refine: PropTypes.func.isRequired,
};
export default connectSearchBox(SearchBox);