-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCustomInput.js
More file actions
46 lines (42 loc) · 1.2 KB
/
Copy pathCustomInput.js
File metadata and controls
46 lines (42 loc) · 1.2 KB
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
43
44
45
46
// React imports
import React, {useContext} from 'react';
import {StyleSheet} from 'react-native';
// Context
import ThemeContext from '../../context/ThemeContext';
// Elements
import Icon from 'react-native-vector-icons/FontAwesome';
import {Input} from 'react-native-elements';
const CustomInput = ({placeholder, iconName, onChangeText}) => {
const {theme} = useContext(ThemeContext);
const styles = localStyles(theme);
return (
// Component start
<Input
onChangeText={onChangeText}
containerStyle={{paddingHorizontal: 0}}
inputContainerStyle={styles.container}
placeholder={placeholder}
placeholderTextColor={theme.app.color.offWhite}
color={theme.font.color.primary}
leftIcon={
<Icon
name={iconName}
size={theme.icon.size.f4}
color={theme.icon.color.primary}
/>
}
/>
// Component end
);
};
// This object is used to style your components
const localStyles = (theme) =>
StyleSheet.create({
container: {
borderWidth: 1,
borderColor: theme.border.color.primary,
paddingHorizontal: theme.spacing.f4,
borderRadius: theme.border.radius.f4,
},
});
export default CustomInput;