-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathDatePickerExamplePage.tsx
More file actions
62 lines (59 loc) · 2.26 KB
/
Copy pathDatePickerExamplePage.tsx
File metadata and controls
62 lines (59 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
'use strict';
import {useState} from 'react';
import * as React from 'react';
import DateTimePicker from '@react-native-community/datetimepicker';
import {Example} from '../components/Example';
import {Page} from '../components/Page';
export const DatePickerExamplePage: React.FunctionComponent<{}> = () => {
const [date1] = useState(new Date());
const [date2] = useState(new Date());
const textExample1 =
'<DateTimePicker value={date} mode="date" style={{width: 200, opacity: 1, height: 50}}/>';
const textExample2 = `<DateTimePicker
value={date2}
mode="date"
style={{width: 200, opacity: 1, height: 50}}
dayOfWeekFormat={'{dayofweek.abbreviated(3)}'}
firstDayOfWeek={1} />`;
return (
<Page
title="DatePicker"
description={
'Use a DatePicker to let users set a date in your app, for example to schedule an appointment. The DatePicker displays three controls for month, date, and year. These controls are easy to use with touch or mouse, and they can be styled and configured in several different ways.'
}
wrappedNativeControl={{
control: 'CalendarDatePicker',
url: 'https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.calendardatepicker?view=winrt-19041',
}}
componentType="Community"
pageCodeUrl="https://github.com/microsoft/react-native-gallery/blob/main/src/examples/DatePickerExamplePage.tsx"
documentation={[
{
label: 'DateTimePicker',
url: 'https://github.com/react-native-datetimepicker/datetimepicker',
},
]}>
<Example title="A simple DatePicker." code={textExample1}>
<DateTimePicker
accessibilityLabel="Simple Example"
value={date1}
onChange={() => {}}
mode="date"
style={{width: 200, opacity: 1, height: 50}}
/>
</Example>
<Example
title="A DatePicker with day of week formatted and first day of week adjusted."
code={textExample2}>
<DateTimePicker
accessibilityLabel="Formatted Example"
value={date2}
mode="date"
style={{width: 200, opacity: 1, height: 50}}
dayOfWeekFormat={'{dayofweek.abbreviated(3)}'}
firstDayOfWeek={1}
/>
</Example>
</Page>
);
};