Skip to content

Commit 1aa9622

Browse files
fix: fix bug with date picker input not filling width ios
1 parent b6e11dc commit 1aa9622

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

example/src/App.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,13 @@ function App() {
192192
<View>
193193
<Row>
194194
<Label>Input</Label>
195-
<Text>
196-
<DatePickerInput
197-
locale={locale}
198-
value={inputDate}
199-
onChange={setInputDate}
200-
inputMode="start"
201-
/>
202-
</Text>
195+
196+
<DatePickerInput
197+
locale={locale}
198+
value={inputDate}
199+
onChange={setInputDate}
200+
inputMode="start"
201+
/>
203202
</Row>
204203
<Row>
205204
<Label>Date</Label>

src/Date/DatePickerInput.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function DatePickerInput(
5454
)
5555

5656
return (
57-
<View>
57+
<>
5858
<View style={styles.root}>
5959
<TextInputWithMask
6060
{...rest}
@@ -93,7 +93,7 @@ function DatePickerInput(
9393
dateMode={inputMode}
9494
/>
9595
) : null}
96-
</View>
96+
</>
9797
)
9898
}
9999

@@ -114,12 +114,16 @@ function getLabel({
114114

115115
const styles = StyleSheet.create({
116116
root: {
117+
minWidth: 150,
117118
flexDirection: 'row',
118119
position: 'relative',
119120
alignItems: 'center',
120-
flex: 1,
121+
flexGrow: 1,
122+
alignSelf: 'flex-start',
123+
},
124+
input: {
125+
flexGrow: 1,
121126
},
122-
input: { flex: 1 },
123127
calendarButton: { position: 'absolute', right: 0 },
124128
})
125129
export default React.forwardRef(DatePickerInput)

0 commit comments

Comments
 (0)