|
| 1 | +import {height} from 'dom-helpers'; |
1 | 2 | import React from 'react'; |
2 | 3 | import {Text, View, TextInput} from 'react-native'; |
3 | 4 |
|
@@ -36,42 +37,58 @@ const Input = ({ |
36 | 37 | } |
37 | 38 |
|
38 | 39 | if (focused) { |
39 | | - return props.focusColor || '#52525B'; |
| 40 | + return props.focusColor || props.borderColor || '#52525B'; |
40 | 41 | } |
| 42 | + return props.borderColor; |
41 | 43 | }; |
42 | 44 |
|
43 | 45 | return ( |
44 | 46 | <> |
45 | 47 | <View style={{...props.labelStyles}}> |
46 | | - {label && <Text>{label}</Text>} |
| 48 | + {label && ( |
| 49 | + <Text style={{color: props.labelTextColor || '#000'}}>{label}</Text> |
| 50 | + )} |
47 | 51 | </View> |
48 | 52 | <View |
49 | 53 | style={{ |
50 | 54 | ...(props.wrapperStyles || { |
51 | | - height: 42, |
52 | | - borderWidth: 1, |
53 | | - borderRadius: 4, |
54 | | - paddingHorizontal: 5, |
55 | | - marginTop: 5, |
56 | | - alignItems: icon ? 'center' : 'baseline', |
| 55 | + height: props.height || 42, |
| 56 | + borderWidth: props.borderWidth || 1, |
| 57 | + borderRadius: props.borderRadius || 4, |
| 58 | + paddingHorizontal: props.paddingHorizontal || 5, |
| 59 | + marginTop: props.marginTop || 5, |
| 60 | + alignItems: 'icon' ? 'center' : 'baseline', |
57 | 61 | borderColor: getBorderColor(), |
58 | | - flexDirection: getFlexDirection(), |
| 62 | + flexDirection: getFlexDirection() || 'row', |
59 | 63 | }), |
60 | 64 | }}> |
61 | | - <View>{icon && icon}</View> |
62 | | - <TextInput |
63 | | - placeholder={placeholder} |
64 | | - style={textInputStyles} |
65 | | - onChangeText={onChangeText} |
66 | | - value={value} |
67 | | - onFocus={() => { |
68 | | - setFocused(true); |
69 | | - }} |
70 | | - onBlur={() => { |
71 | | - setFocused(false); |
72 | | - }} |
73 | | - {...props} |
74 | | - /> |
| 65 | + <View |
| 66 | + style={{ |
| 67 | + flex: 1, |
| 68 | + alignItems: 'center', |
| 69 | + }}> |
| 70 | + {icon && icon} |
| 71 | + </View> |
| 72 | + <View |
| 73 | + style={{ |
| 74 | + flex: 8, |
| 75 | + height: props.height || 42, |
| 76 | + }}> |
| 77 | + <TextInput |
| 78 | + placeholder={placeholder} |
| 79 | + style={textInputStyles} |
| 80 | + color={props.color || '#000'} |
| 81 | + onChangeText={onChangeText} |
| 82 | + value={value} |
| 83 | + onFocus={() => { |
| 84 | + setFocused(true); |
| 85 | + }} |
| 86 | + onBlur={() => { |
| 87 | + setFocused(false); |
| 88 | + }} |
| 89 | + {...props} |
| 90 | + /> |
| 91 | + </View> |
75 | 92 | </View> |
76 | 93 | <View> |
77 | 94 | {error && ( |
|
0 commit comments