Skip to content

Commit 978e10e

Browse files
fix: fix layout of date picker input
1 parent 86a93e8 commit 978e10e

File tree

1 file changed

+34
-32
lines changed

1 file changed

+34
-32
lines changed

src/Date/DatePickerInputWithoutModal.tsx

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -44,35 +44,31 @@ function DatePickerInputWithoutModal(
4444
return (
4545
<>
4646
<View style={styles.root}>
47-
<TextInputWithMask
48-
{...rest}
49-
ref={ref}
50-
label={getLabel({
51-
// TODO: support label components?
52-
label: label as any,
53-
inputFormat,
54-
withDateFormatInLabel,
55-
})}
56-
value={formattedValue}
57-
keyboardType={'number-pad'}
58-
placeholder={inputFormat}
59-
mask={inputFormat}
60-
onChangeText={onChangeText}
61-
keyboardAppearance={theme.dark ? 'dark' : 'default'}
62-
error={!!error}
63-
style={style}
64-
/>
65-
{inputButtons}
66-
{!!error ? (
67-
<View style={styles.helperText}>
68-
<HelperText
69-
style={styles.helperText}
70-
type="error"
71-
visible={!!error}
72-
>
73-
{error}
74-
</HelperText>
75-
</View>
47+
<View style={styles.inputContainer}>
48+
<TextInputWithMask
49+
{...rest}
50+
ref={ref}
51+
label={getLabel({
52+
// TODO: support label components?
53+
label: label as any,
54+
inputFormat,
55+
withDateFormatInLabel,
56+
})}
57+
value={formattedValue}
58+
keyboardType={'number-pad'}
59+
placeholder={inputFormat}
60+
mask={inputFormat}
61+
onChangeText={onChangeText}
62+
keyboardAppearance={theme.dark ? 'dark' : 'default'}
63+
error={!!error}
64+
style={[styles.input, style]}
65+
/>
66+
{inputButtons}
67+
</View>
68+
{error ? (
69+
<HelperText style={styles.helperText} type="error" visible={!!error}>
70+
{error}
71+
</HelperText>
7672
) : null}
7773
</View>
7874
{modal?.({ value, locale, inputMode, validRange, saveLabel })}
@@ -97,14 +93,20 @@ function getLabel({
9793

9894
const styles = StyleSheet.create({
9995
root: {
100-
flex: 1,
10196
flexGrow: 1,
97+
backgroundColor: 'pink',
10298
},
103-
helperTextContainer: {
99+
inputContainer: {
100+
flexGrow: 1,
104101
flexDirection: 'row',
102+
alignItems: 'center',
103+
justifyContent: 'flex-start',
104+
},
105+
input: {
106+
flexGrow: 1,
105107
},
106108
helperText: {
107-
flex: 1,
109+
// flex: 1,
108110
},
109111
})
110112
export default React.forwardRef(DatePickerInputWithoutModal)

0 commit comments

Comments
 (0)