on iOS, onConfirm does NOT return the picked date
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", }); }}
/>
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).
Any solution for this?
I am running into the same issue... is there an earlier version that works?
Same issue
I just updated the dependency library @react-native-community/datetimepicker to version 8.5.0, and it started working.