Skip to content

on iOS, onConfirm does NOT return the picked date #771

@Bilal-Abdeen

Description

@Bilal-Abdeen

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", }); }}
/>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions