Skip to content

Commit 71afa3a

Browse files
Fix bugs with time picker and prepare for v1.0.0
1 parent 31184da commit 71afa3a

File tree

15 files changed

+423
-219
lines changed

15 files changed

+423
-219
lines changed

README.md

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
## react-native-paper-dates
22

3-
- Smooth and fast cross platform Material Design date picker for React Native Paper
3+
- Smooth and fast cross platform Material Design **date** picker and **time** picker for React Native Paper
44
- 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
77
- Typesafe
88
- Endless scrolling
99
- Performant
10+
- Great react-native-web support
1011

1112
Older demo of this library
1213
<img src="https://user-images.githubusercontent.com/6492229/90681177-4970f280-e263-11ea-8257-6810c5166f92.gif"/>
@@ -117,11 +118,69 @@ export default function RangeDatePage() {
117118
```
118119

119120

121+
### Time picker
122+
```tsx
123+
import * as React from 'react'
124+
import { Button } from 'react-native-paper'
125+
import { TimePickerModal } from 'react-native-paper-dates'
126+
127+
export default function RangeDatePage() {
128+
const [visible, setVisible] = React.useState(false)
129+
const onDismiss = React.useCallback(() => {
130+
setVisible(false)
131+
}, [setVisible])
132+
133+
const onConfirm = React.useCallback(
134+
({ hours, minutes }) => {
135+
setVisible(false);
136+
console.log({ hours, minutes });
137+
},
138+
[setVisible]
139+
);
140+
141+
142+
return (
143+
<>
144+
<TimePickerModal
145+
visible={visible}
146+
onDismiss={onDismiss}
147+
onConfirm={onConfirm}
148+
label={'Select time'} // optional, default 'Select time'
149+
cancelLabel="Cancel" // optional, default: 'Cancel'
150+
confirmLabel="Ok" // optional, default: 'Ok'
151+
hours={12} // optional, default: current hours
152+
minutes={14} // optional, default: current minutes
153+
/>
154+
<Button onPress={()=> setVisible(true)}>
155+
Pick time
156+
</Button>
157+
</>
158+
)
159+
}
160+
```
161+
162+
163+
164+
165+
120166

121167
## Roadmap
122-
Things on our roadmap are labeled with enhancement.
168+
Things on our roadmap have labels with `enhancement`.
123169
https://github.com/web-ridge/react-native-paper-dates/issues
124170

171+
## Tips & Tricks
172+
- Use 0.14+ version of React-Native-Web
173+
- Try to avoid putting the pickers inside of a scrollView
174+
If that is **not possible** use the following props on the surrounding ScrollViews/Flatlists
175+
176+
```javascript
177+
keyboardDismissMode="on-drag"
178+
keyboardShouldPersistTaps="handled"
179+
contentInsetAdjustmentBehavior="always"
180+
```
181+
This is to prevent the need to press 2 times before save works (1 press for closing keyboard, 1 press for confirm/close)
182+
(https://github.com/facebook/react-native/issues/10138)
183+
125184
## Android Caveats
126185

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

example/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
"react-dom": "^16.13.1",
3030
"react-native": "0.63.2",
3131
"react-native-localize": "^1.4.1",
32-
"react-native-vector-icons": "^7.1.0",
33-
"react-native-web": "^0.0.0-80dae21e2",
32+
"react-native-vector-icons": "https://github.com/RichardLindhout/react-native-vector-icons",
33+
"react-native-web": "^0.14.8",
3434
"react-scripts": "3.4.3"
3535
},
3636
"devDependencies": {

0 commit comments

Comments
 (0)