DatePicker
A control for selecting an absolute date.
Example​
- swiftui-react-native
- SwiftUI
const today = useMemo(() => new Date(), []);
const date = useBinding(today);
<DatePicker
title="Select a date"
selection={date}
displayedComponents={['date', 'hourAndMinute']}
/>
@State var date = Date()
DatePicker("Select a date", selection: $date, displayedComponents: [.date, .hourAndMinute])
Props​
ColorPicker inherits all View Modifiers as props.
prop | description | type | required | default |
---|---|---|---|---|
selection | The date value | Date | yes | undefined |
onChange | Function to execute when a date selection is made | (v: Date) => void | no | undefined |
displayedComponents | The components to display | 'date' \| 'hourAndMinute' \| ('date' \| 'hourAndMinute')[]; | no | ['date', 'hourAndMinute'] |