concept DatePickerIOS in category react native

appears as: DatePickerIOS
React Native in Action

This is an excerpt from Manning's book React Native in Action.

DatePickerIOS provides an easy way to implement a native date picker component on iOS. It has three modes that come in handy when working with dates and times: date, time, and dateTime, shown in figure 10.1.

Figure 10.1 DatePickerIOS with date mode, time mode, and datetime mode

c10_01.eps

DatePickerIOS has the props listed in table 10.1. The minimum props that need to be passed are date (the date that’s the beginning or current date choice) and an onDateChange method. When any of the date values are changed, onDateChange is called, passing the function the new date value.

Table 10.1 DatePickerIOS props and method
Prop Type Description
date Date Currently selected date
maximumDate Date Maximum allowed date
minimumDate Date Minimum allowed date
minuteInterval Enum Interval at which minutes can be selected
mode String: date, time, or datetime Date picker mode
onDateChange Function: onDateChange(date) { } Function called when the date changes
timeZoneOffsetInMinutes Number Time zone offset in minutes; overrides the default (the device time zone)