react-native-modal-datetime-picker icon indicating copy to clipboard operation
react-native-modal-datetime-picker copied to clipboard

on iOS, onConfirm does NOT return the picked date

Open Bilal-Abdeen opened this issue 10 months ago • 5 comments

I have seen the FAQ on iOS, onConfirm does NOT return the picked date. However, I am having this issue no matter when the "Confirm" button is clicked.

Current Versions: "react-native": "0.77.0", "@react-native-community/datetimepicker": "^8.3.0", "react-native-modal-datetime-picker": "^18.0.0",

An older version of my code is working fine. It uses the following versions: "react-native": "0.73.6", "@react-native-community/datetimepicker": "^7.6.3", "react-native-modal-datetime-picker": "^17.1.0",

<DateTimePickerModal
  isVisible={state.isFromDatePickerVisible}
  mode={"date"}
  display="default"
  isDarkModeEnabled={theme.colors.themeMode === "dark"} 
  pickerComponentStyleIOS={{height: customTheme.sizes.defaultFontSize * 3}} 
  date={props.oJob.jobDayBasedFromDate}
  onConfirm={(value) => {
    // console.log("from date - onConfirm - ", "value:", value, value.toISOString()); // this does NOT provide the picked date!
    dispatch({ type: "hide_from_date_picker", }); 
    // code to store the picked date to props.oJob.jobDayBasedFromDate comes here 
  }}
  onCancel={() => { dispatch({ type: "hide_from_date_picker", }); }}
/>

Bilal-Abdeen avatar Mar 07 '25 01:03 Bilal-Abdeen

To add to this, onChange is not firing either on iOS when using the latest versions. I think the issue is likely coming from react-native-datetimepicker not being ready for react native 0.77 (https://github.com/react-native-datetimepicker/datetimepicker/issues/965).

jesuscc1993 avatar Apr 03 '25 11:04 jesuscc1993

Any solution for this?

tuannguyenhoangit-droid avatar Apr 30 '25 09:04 tuannguyenhoangit-droid

I am running into the same issue... is there an earlier version that works?

dstarck-infuse avatar Jun 09 '25 23:06 dstarck-infuse

Same issue

parthkanani93 avatar Jul 08 '25 12:07 parthkanani93

I just updated the dependency library @react-native-community/datetimepicker to version 8.5.0, and it started working.

sahil2401 avatar Nov 03 '25 07:11 sahil2401