DateTimePicker not displaying correctly on iOS
Asked Answered
S

1

7

I am working on a React Native mobile app, and I we had a bug for the iOS DateTimePicker not displaying correctly. I am using the `DateTimePickerfrom@react-native-community/datetimepicker``.

I set the width of the DateTimePicker to 100% and this made the picker visible. However, the picker button aligns to the right side of the screen and I cannot seem to center it.

iOS picker button aligns left

iOS calendar when clicking picker button

Also, on the Android version, when I click the Date of Birth button, a calendar is displayed right away, where as on iOS, a little button appears, which I must then click to display the calendar.

So, is there a way to display the calendar on iOS upon clicking the DOB button, if not, does anyone know why the button that pops up does not center? I saw some other people online had the same issue, but I couldn't find a solution.

Thannks

Standoffish answered 18/11, 2021 at 10:55 Comment(0)
F
1
<DateTimePicker
 .....
 display={Platform.OS === 'ios' ? 'inline' : 'default'}
 />
Fifteenth answered 16/8, 2022 at 9:35 Comment(1)
Please read How do I write a good answer?. While this code block may answer the OP's question, this answer would be much more useful if you explain how this code is different from the code in the question, what you've changed, why you've changed it and why that solves the problem without introducing others.Exequatur

© 2022 - 2024 — McMap. All rights reserved.