简体   繁体   中英

React-Native DatePickerIOS minimumDate prop

I am fairly new to react-native and especially working with the DatePickerIOS component. I see that there is a prop minimumDate as per the react-native docs however I cant seem to find examples of its use anywhere. Basically all I am trying to do is some simple validation so that the user cannot pick a date in the past.

I have tried simply:

<DatePickerIOS
  date={this.state.timerDate}
  mode="time"
  timeZoneOffsetInMinutes = {this.state.timeZoneOffsetInHours * 60}
  minuteInterval={1}
  onDateChange = {this._onDateChange}
  minimunDate = {this.state.date}
/>

Where this.state.date is the current time. But this does not seem to be working at all.

What do you mean when you say it's not working at all? Are there any errors thrown? Do the rest of the component's features/props function as you would expect?

You have a typo in your example. The prop name should be minimumDate , not minimunDate .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM