Skip to content

Commit a7cd7c9

Browse files
Merge branch 'master' of github.com:web-ridge/react-native-paper-dates
2 parents 4562441 + b5d51d1 commit a7cd7c9

File tree

1 file changed

+63
-43
lines changed

1 file changed

+63
-43
lines changed

README.md

Lines changed: 63 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,42 @@
1-
## react-native-paper-dates (WIP, no offical release yet)
2-
3-
Demo: (https://twitter.com/RichardLindhout/status/1294636692540985344)
1+
## react-native-paper-dates
42

3+
- Smooth and fast cross platform date picker for React Native Paper
4+
- Tested on Android, iOS and the web platform!
55
- Uses the native Date.Intl API's which work out of the box on the web / iOS
66
- Simple API
7-
- Endless scrolling on both web (with react-window) / and VirtualizedList on other platforms
7+
- Typesafe
8+
- Endless scrolling
89
- Performant
910

11+
<img src="https://user-images.githubusercontent.com/6492229/90681177-4970f280-e263-11ea-8257-6810c5166f92.gif"/>
12+
13+
## Getting started
14+
15+
Yarn
16+
```
17+
yarn add react-native-paper-dates
18+
```
19+
20+
npm
21+
```
22+
npm install react-native-paper-dates --save
23+
```
24+
25+
### Web
26+
If you use react-native-web and want to use this library you'll need to install react-window.
27+
Yarn
28+
```
29+
yarn add react-window
30+
```
31+
32+
npm
33+
```
34+
npm install react-window --save
35+
```
36+
1037
## Usage
1138

12-
### Single date
39+
### Date Picker
1340

1441
```tsx
1542
import * as React from 'react'
@@ -31,24 +58,24 @@ function SingleDatePage() {
3158

3259
return (
3360
<>
34-
<DatePickerModal
35-
mode="single"
36-
visible={visible}
37-
onDismiss={onDismiss}
38-
date={date}
39-
onConfirm={onChange}
40-
saveLabel={'Save'} // optional
41-
label={'Select period'} // optional
42-
/>
43-
<Button onPress={()=> setVisible(true)}>
44-
Pick date
45-
</Button>
61+
<DatePickerModal
62+
mode="single"
63+
visible={visible}
64+
onDismiss={onDismiss}
65+
date={date}
66+
onConfirm={onChange}
67+
saveLabel={'Save'} // optional
68+
label={'Select period'} // optional
69+
/>
70+
<Button onPress={()=> setVisible(true)}>
71+
Pick date
72+
</Button>
4673
</>
4774
)
4875
}
4976
```
5077

51-
### Start / end
78+
### Range picker
5279
```tsx
5380
import * as React from 'react'
5481
import { Button } from 'react-native-paper'
@@ -68,21 +95,21 @@ export default function RangeDatePage() {
6895

6996
return (
7097
<>
71-
<DatePickerModal
72-
mode="range"
73-
visible={visible}
74-
onDismiss={onDismiss}
75-
startDate={undefined}
76-
endDate={undefined}
77-
onConfirm={onChange}
78-
saveLabel={'Save'} // optional
79-
label={'Select period'} // optional
80-
startLabel={'From'} // optional
81-
endLabel={'To'} // optional
82-
/>
83-
<Button onPress={()=> setVisible(true)}>
84-
Pick range
85-
</Button>
98+
<DatePickerModal
99+
mode="range"
100+
visible={visible}
101+
onDismiss={onDismiss}
102+
startDate={undefined}
103+
endDate={undefined}
104+
onConfirm={onChange}
105+
saveLabel={'Save'} // optional
106+
label={'Select period'} // optional
107+
startLabel={'From'} // optional
108+
endLabel={'To'} // optional
109+
/>
110+
<Button onPress={()=> setVisible(true)}>
111+
Pick range
112+
</Button>
86113
</>
87114
)
88115
}
@@ -91,17 +118,10 @@ export default function RangeDatePage() {
91118

92119

93120
## Roadmap
121+
Things on our roadmap are labeled with enhancement.
122+
https://github.com/web-ridge/react-native-paper-dates/issues
94123

95-
- Follow all things in spec (https://material.io/components/date-pickers#mobile-pickers)
96-
- TimePicker component
97-
- Selecting year in single input
98-
- Optional locale overriding (date formatting)
99-
- Optional timezone overriding
100-
- Option to start day of week on monday (or read this from timezone/locale)
101-
- Direct input with modal suffix
102-
- Mobile input picker
103-
104-
### Android Caveats
124+
## Android Caveats
105125

106126
You will need to add a polyfill for the Intl API on Android if:
107127

0 commit comments

Comments
 (0)