react-native-modal-datetime-picker: DatePickerIOS minuteInterval prop doesn't work.

<DateTimePicker
     mode="time"
     minuteInterval='15'
     isVisible={ this.state.pickerOpened }
     onCancel={() => this.setState({pickerOpened: false}) }
     onConfirm={(date) => {
         this.setState({pickerOpened: false});
     }}
 />

Should display 00, 15, 30, 45 for the minutes, but instead shows 0-59

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18 (5 by maintainers)

Most upvoted comments

Tried different options, the only one that worked, based on @temitope 's suggestion is:

    _hideDateTimePicker = () => {
        this.setState({ isDateTimePickerVisible: false });
        setTimeout(() => this.setState({minuteInterval: 1}), 300);
    };

    _showDateTimePicker = () => {
        this.setState({ isDateTimePickerVisible: true });
        setTimeout(() => this.setState({minuteInterval: 15}), 10);
    };

https://github.com/react-native-datetimepicker/datetimepicker#minuteinterval-optional

It’s written there, “on iOS, this in only supported when display=“spinner””,

It should be display=‘spinner’ for the react-native-datetimepicker.

nix that. @ChristianTucker doesnt work on multiple opens (because no re-rendering since no detected changes)…unless you go deeper into the hack hole. Sorry. hope they fix this

setTimeout(()=>{ this.setState({ picker_time_interval:1}); }, 100);
setTimeout(()=>{ this.setState({ picker_time_interval:15}); }, 250);