react-native-datepicker icon indicating copy to clipboard operation
react-native-datepicker copied to clipboard

Canael Manually is not available

Open somushanker44 opened this issue 5 years ago • 1 comments

Issue

I want to close the modal after 10 seconds for which I tried using onPressCacel which is not working.

Expected Behavior

when you click on the date picker we should be able to dismiss the modal even with out confirm or cancel only then we can say it as a controlled component but this date picker uncontrolled.

Code

export default class App extends Component { state = { date: "2018-08-30" }

componentDidMount() {
  this.datePicker.onPressDate()
  setTimeout(() => {
    this.datePicker.onPressCancel()
  }, 5000)
}

render() {
  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <DatePicker
        style={{ width: 200 }}
        date={this.state.date}
        mode="date"
        duration={0}
        placeholder="select date"
        format="YYYY-MM-DD"
        confirmBtnText="Confirm"
        ref={ref => this.datePicker = ref}
        cancelBtnText="Cancel"
        onDateChange={(date) => { this.setState({ date: date }) }}
      />
    </View>
  );
}

}


Environment

  1. react-native -v:
  2. node -v:
  3. npm -v:
  4. yarn --version:
  5. target platform: Android | iOS
  6. operating system:

somushanker44 avatar Jan 28 '20 19:01 somushanker44

lo solucionaste?

asmudevicsar avatar Jul 19 '22 19:07 asmudevicsar