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.22k stars 341 forks source link

Modal get closed on confirm date( modal={true}, if i have't change open state to false. #442

Closed rohit-chandan closed 2 years ago

rohit-chandan commented 2 years ago

Describe the bug Modal get closed on confirm date button press( modal={true}, even if i have't change open state to false.

Expected behavior The controlled way should be, Modal should't close until I changed the open state from true to false.

To Reproduce Add example code that reproduces the behavior. <DatePicker date={new Date(currentDate)} mode="datetime" androidVariant="nativeAndroid" minimumDate={new Date(currentDate)} maximumDate={new Date(moment(currentDate).add(23, 'd').format('YYYY-MM-DD'))} fadeToColor={Color.WHITE_COLOR}

      modal
      open={showDateModal}
      onConfirm={(date) => {
        if (moment(date).format("d") !== '1'){
          ToastError({ message: "Only monday are available to start diet plan" })
        }
        else {
          Toast({ message: "Success! Monday choosed" })
          this.setState({
            showDateModal: false,
            selectedDate: moment(date).format('YYYY-MM-DD')
          })
        }

      }}
      onCancel={() => {
        this.setState({ showDateModal: false })
      }}

Smartphone (redmi 10):

henninghall commented 2 years ago

Please include the platforms, versions etc as described in the issue template

rohit-chandan commented 2 years ago

@henninghall These are the spec(also edited in issue) - Smartphone (Redmi note 10):