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.21k stars 338 forks source link

Illegal callback invocation from native module #836

Closed Success-DevAI closed 3 months ago

Success-DevAI commented 3 months ago

Describe the bug When I quickly click open and then cancel the date picker, sometimes an error modal appears with the message "Illegal callback invocation from native module." After this, I am unable to open the modal again. The state of open remains true even though the modal is closed.

Expected behavior I should be able to repeatedly open and close the modal without encountering any errors or issues.

To Reproduce When I click to open the date picker, the modal should appear. If I cancel the date picker, the modal should close without any errors. The state of open should correctly reflect the visibility of the modal. If the modal is closed, the state should be false; if the modal is open, the state should be true.

export default class App extends Component {

  state = { date: new Date() }

  render = () =>
    <DatePicker
      date={this.state.date}
      onDateChange={date => this.setState({ date })}
      open={open}
    />

}

Smartphone (please complete the following information):