-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathInput.js
54 lines (50 loc) · 1.06 KB
/
Input.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
43
44
45
46
47
48
49
50
51
52
53
54
import { View, Text, TextInput, StyleSheet } from 'react-native';
import { Colors } from '../../constants/styles';
function Input({
label,
keyboardType,
secure,
onUpdateValue,
value,
isInvalid,
}) {
return (
<View style={styles.inputContainer}>
<Text style={[styles.label, isInvalid && styles.labelInvalid]}>
{label}
</Text>
<TextInput
style={[styles.input, isInvalid && styles.inputInvalid]}
autoCapitalize={false}
autoCapitalize="none"
keyboardType={keyboardType}
secureTextEntry={secure}
onChangeText={onUpdateValue}
value={value}
/>
</View>
);
}
export default Input;
const styles = StyleSheet.create({
inputContainer: {
marginVertical: 8,
},
label: {
color: 'white',
marginBottom: 4,
},
labelInvalid: {
color: Colors.error500,
},
input: {
paddingVertical: 8,
paddingHorizontal: 6,
backgroundColor: Colors.primary100,
borderRadius: 4,
fontSize: 16,
},
inputInvalid: {
backgroundColor: Colors.error100,
},
});