henninghall / react-native-date-picker

React Native Date Picker is datetime picker for Android and iOS. It includes date, time and datetime picker modes. The datepicker is customizable and is supporting different languages. It's written with native code to achieve the best possible look, feel and performance.
MIT License
2.25k stars 345 forks source link

Date and time picker is not working properly in Android using version 4.3.3 #711

Open Udayan-KS opened 1 year ago

Udayan-KS commented 1 year ago

Both the Date and Time picker are behaving in a weird manner in Android while using version 4.3.3. The modal will only show up once and upon selecting the confirm button, onConfirm callback is not triggered. But it's working properly in iOS. If downgraded to 4.2.14 there is no issue. The new architecture is not used in the project.

Expected behavior The modal should pop up each time the open prop flag is set to true and the confirm button should trigger onConfirm callback

Smartphone:

erikahendsel commented 1 year ago

I would like to add, it seems to work if you wait until the date inputs are perfectly scrolled to center. If you are bit too fast to press confirm, it does not detect the changes.

Danyal255 commented 11 months ago

I'm facing same error in android it did not work properly specially setting up the date. When I click on confirm it did not set the date and also when I try to open it next time even tho my state get true it did not open Date Picker. I have a same version react-native-date-picker version 4.3.3 but when I downgraded to 4.2.14 it work for me Thanks @UdayanTV

Elolawyn commented 11 months ago

The same happens to me with the last version on android regarding the onConfirm. The modal opens just fine all the time.

I am using the modal android native variant with a react state = undefined as date and when onConfirm executes I assign the returned value to the date react state.

It works fine but only if I wait until the date inputs are perfectly scrolled to center just like @erikahendsel said. Downgrading to 4.2.14 did not do anything.

Jxy1230 commented 6 months ago

[react-native-date-picker/android/src/main/java/com/henninghall/date_picker/ui/WheelChangeListenerImpl.java] change before: if (minDate != null && selectedDate.before(minDate)) { uiManager.animateToDate(minDate); return; } change after: if (minDate != null && selectedDate.before(minDate)) { uiManager.animateToDate(minDate); Emitter.onDateChange(minDate, minDate.toString(), state.getId(), rootView); return; } I think will help you

Knorway commented 3 months ago

it does not invoke onConfirm callback after navigating back to the screen that returns DatePicker in my case. downgrading the package from 5.0.0 to 4.2.13 solved it