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.25k stars 346 forks source link

When testing with modal true, jest test fails with "Cannot read properties of null (reading 'openPicker')" #761

Closed Ryan-Durling closed 9 months ago

Ryan-Durling commented 9 months ago

Describe the bug When testing with jest and setting modal to true it throws an exception.

Cannot read properties of null (reading 'openPicker')
TypeError: Cannot read properties of null (reading 'openPicker')
    at DatePickerAndroid.openPicker [as render] 

Expected behavior A clear and concise description of what you expected to happen.

renders without error in jest test

To Reproduce Add example code that reproduces the behavior.

it('does something') {
    render(<DatePicker
        modal={true}
        ... other props ...
      />)

        ... the rest of the test...
}

Smartphone (please complete the following information):