Skip to content

Commit 7daeeef

Browse files
authored
Merge pull request #64 from troberts-28/release/v2.3.0
Release/v2.3.0
2 parents ab1f4a5 + 1813223 commit 7daeeef

File tree

18 files changed

+2965
-382
lines changed

18 files changed

+2965
-382
lines changed

.github/workflows/release.yml

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
name: "🚀 release"
2+
23
on:
3-
push:
4-
branches:
5-
- main
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
id-token: write # Required for OIDC
10+
contents: read
611

712
jobs:
813
release:
914
name: 🚀 release
1015
runs-on: ubuntu-latest
1116
steps:
12-
- name: checkout
13-
uses: actions/checkout@v1
14-
- name: Setup Node.js
15-
uses: actions/setup-node@v1
16-
with:
17-
node-version: 20
18-
registry-url: https://registry.npmjs.org
19-
- name: Install dependencies
20-
run: yarn
21-
- name: Release
22-
run: npm publish
23-
env:
24-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
17+
- name: checkout
18+
uses: actions/checkout@v4
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
registry-url: https://registry.npmjs.org
24+
- name: Update npm
25+
run: npm install -g npm@latest
26+
- name: Install dependencies
27+
run: yarn
28+
- name: Release
29+
run: npm publish

README.md

Lines changed: 180 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=for-the-badge)]()
44
![platforms](https://img.shields.io/badge/platforms-Android%20%7C%20iOS-brightgreen.svg?style=for-the-badge&colorB=191A17)
55
[![Version](https://img.shields.io/npm/v/react-native-timer-picker.svg?style=for-the-badge)](https://www.npmjs.com/package/react-native-timer-picker)
6-
[![npm](https://img.shields.io/npm/dt/react-native-timer-picker.svg?style=for-the-badge)](https://www.npmjs.com/package/react-native-timer-picker)
6+
<!-- [![npm](https://img.shields.io/npm/dt/react-native-timer-picker.svg?style=for-the-badge&cacheSeconds=86400)](https://www.npmjs.com/package/react-native-timer-picker) -->
77

88
A simple, flexible, performant duration picker component for React Native apps 🔥
99

@@ -13,37 +13,37 @@ Works with Expo and bare React Native apps ✅
1313

1414
Includes iOS-style haptic and audio feedback 🍏
1515

16-
- [React Native Timer Picker ⏰🕰️⏳](#react-native-timer-picker-️)
17-
- [Demos 📱](#demos-)
18-
- [Installation 🚀](#installation-)
19-
- [Peer Dependencies 👶](#peer-dependencies-)
20-
- [Linear Gradient](#linear-gradient)
21-
- [Masked View](#masked-view)
22-
- [Examples 😎](#examples-)
23-
- [Timer Picker Modal (Dark Mode) 🌚](#timer-picker-modal-dark-mode-)
24-
- [Timer Picker Modal (Light Mode) 🌞](#timer-picker-modal-light-mode-)
25-
- [Timer Picker with Transparent Fade-Out (Dark Mode) 🌒](#timer-picker-with-transparent-fade-out-dark-mode-)
26-
- [Timer Picker with Customisation (Light Mode) 🌔](#timer-picker-with-customisation-light-mode-)
27-
- [Props 💅](#props-)
28-
- [TimerPicker ⏲️](#timerpicker-️)
29-
- [Custom Styles 👗](#custom-styles-)
30-
- [Performance](#performance)
31-
- [Custom FlatList](#custom-flatlist)
32-
- [TimerPickerModal ⏰](#timerpickermodal-)
33-
- [Custom Styles 👕](#custom-styles--1)
34-
- [Methods 🔄](#methods-)
35-
- [TimerPicker](#timerpicker)
36-
- [TimerPickerModal](#timerpickermodal)
37-
- [Picker Feedback 📳🔉](#picker-feedback-)
38-
- [Audio Feedack](#audio-feedack)
39-
- [Haptic Feedback](#haptic-feedback)
40-
- [Feedback Example](#feedback-example)
41-
- [Expo-Specific Audio/Haptic Feedback (DEPRECATED)](#expo-specific-audiohaptic-feedback-deprecated)
42-
- [Contributing 🧑‍🤝‍🧑](#contributing-)
43-
- [Dev Setup](#dev-setup)
44-
- [GitHub Guidelines](#github-guidelines)
45-
- [Limitations ⚠](#limitations-)
46-
- [License 📝](#license-)
16+
- [Demos 📱](#demos-)
17+
- [Installation 🚀](#installation-)
18+
- [Peer Dependencies 👶](#peer-dependencies-)
19+
- [Linear Gradient](#linear-gradient)
20+
- [Masked View](#masked-view)
21+
- [Examples 😎](#examples-)
22+
- [Timer Picker Modal (Dark Mode) 🌚](#timer-picker-modal-dark-mode-)
23+
- [Timer Picker Modal (Light Mode) 🌞](#timer-picker-modal-light-mode-)
24+
- [Timer Picker Modal with Custom Buttons 🎨](#timer-picker-modal-with-custom-buttons-)
25+
- [Timer Picker with Transparent Fade-Out (Dark Mode) 🌒](#timer-picker-with-transparent-fade-out-dark-mode-)
26+
- [Timer Picker with Customisation (Light Mode) 🌔](#timer-picker-with-customisation-light-mode-)
27+
- [Props 💅](#props-)
28+
- [TimerPicker ⏲️](#timerpicker-️)
29+
- [Custom Styles 👗](#custom-styles-)
30+
- [Performance](#performance)
31+
- [Custom FlatList](#custom-flatlist)
32+
- [TimerPickerModal ⏰](#timerpickermodal-)
33+
- [Custom Styles 👕](#custom-styles--1)
34+
- [Methods 🔄](#methods-)
35+
- [TimerPicker](#timerpicker)
36+
- [TimerPickerModal](#timerpickermodal)
37+
- [Picker Feedback 📳🔉](#picker-feedback-)
38+
- [Audio Feedack](#audio-feedack)
39+
- [Haptic Feedback](#haptic-feedback)
40+
- [Feedback Example](#feedback-example)
41+
- [Expo-Specific Audio/Haptic Feedback (DEPRECATED)](#expo-specific-audiohaptic-feedback-deprecated)
42+
- [Contributing 🧑‍🤝‍🧑](#contributing-)
43+
- [Dev Setup](#dev-setup)
44+
- [GitHub Guidelines](#github-guidelines)
45+
- [Limitations ⚠](#limitations-)
46+
- [License 📝](#license-)
4747

4848
<br>
4949

@@ -53,11 +53,12 @@ Includes iOS-style haptic and audio feedback 🍏
5353

5454
<p>
5555
<img src="demos/example1.gif" width="250" height="550" style="margin-right:50px"/>
56-
<img src="demos/example2.gif" width="250" height="550"/>
56+
<img src="demos/example2.gif" width="250" height="550" style="margin-right:50px"/>
57+
<img src="demos/example3.gif" width="250" height="550" />
5758
</p>
5859
<p>
59-
<img src="demos/example3.gif" width="250" height="550" style="margin-right:50px"/>
60-
<img src="demos/example4.gif" width="250" height="550"/>
60+
<img src="demos/example4.gif" width="250" height="550" style="margin-right:50px"/>
61+
<img src="demos/example5.gif" width="250" height="550"/>
6162
</p>
6263

6364
<br>
@@ -106,6 +107,8 @@ To make the numbers fade in/out on a transparent background (e.g. if the picker
106107

107108
### Timer Picker Modal (Dark Mode) 🌚
108109

110+
<img src="demos/example1.gif" width="250" height="550"/>
111+
109112
```jsx
110113
import { TimerPickerModal } from "react-native-timer-picker";
111114
import { LinearGradient } from "expo-linear-gradient"; // or `import LinearGradient from "react-native-linear-gradient"`
@@ -200,10 +203,10 @@ return (
200203

201204
```
202205

203-
<img src="demos/example1.gif" width="250" height="550"/>
204-
205206
### Timer Picker Modal (Light Mode) 🌞
206207

208+
<img src="demos/example2.gif" width="250" height="550"/>
209+
207210
```jsx
208211
import { TimerPickerModal } from "react-native-timer-picker";
209212
import { LinearGradient } from "expo-linear-gradient"; // or `import LinearGradient from "react-native-linear-gradient"`
@@ -295,10 +298,145 @@ return (
295298

296299
```
297300

298-
<img src="demos/example2.gif" width="250" height="550"/>
301+
### Timer Picker Modal with Custom Buttons 🎨
302+
303+
<img src="demos/example3.gif" width="250" height="550"/>
304+
305+
```jsx
306+
import { TimerPickerModal } from "react-native-timer-picker";
307+
import { LinearGradient } from "expo-linear-gradient"; // or `import LinearGradient from "react-native-linear-gradient"`
308+
import { TouchableOpacity, Text, StyleSheet, Platform } from "react-native";
309+
310+
// Custom Button Component
311+
interface MyCustomButtonProps {
312+
label: string;
313+
onPress?: () => void;
314+
}
315+
316+
const MyCustomButton: React.FC<MyCustomButtonProps> = ({ label, onPress }) => {
317+
return (
318+
<TouchableOpacity onPress={onPress} style={styles.customButtonContainer}>
319+
<LinearGradient
320+
style={styles.customButtonGradient}
321+
colors={['#bb2649', '#6c35de']}
322+
start={{ x: 0, y: 0 }}
323+
end={{ x: 1, y: 1 }}
324+
>
325+
<Text style={styles.customButtonText}>{label}</Text>
326+
</LinearGradient>
327+
</TouchableOpacity>
328+
);
329+
};
330+
331+
// Styles
332+
const styles = StyleSheet.create({
333+
customButtonContainer: {
334+
marginHorizontal: 5,
335+
},
336+
customButtonGradient: {
337+
borderRadius: 15,
338+
paddingVertical: 12,
339+
paddingHorizontal: 20,
340+
alignItems: 'center',
341+
justifyContent: 'center',
342+
},
343+
customButtonText: {
344+
color: '#FFFFFF',
345+
fontSize: 16,
346+
fontWeight: '600',
347+
},
348+
});
349+
350+
....
351+
const [showPicker, setShowPicker] = useState(false);
352+
const [alarmString, setAlarmString] = useState<string>("00:00:00");
353+
354+
const formatTime = ({
355+
hours,
356+
minutes,
357+
seconds,
358+
}: {
359+
hours?: number;
360+
minutes?: number;
361+
seconds?: number;
362+
}) => {
363+
const timeParts = [];
364+
365+
if (hours !== undefined) {
366+
timeParts.push(hours.toString().padStart(2, "0"));
367+
}
368+
if (minutes !== undefined) {
369+
timeParts.push(minutes.toString().padStart(2, "0"));
370+
}
371+
if (seconds !== undefined) {
372+
timeParts.push(seconds.toString().padStart(2, "0"));
373+
}
374+
375+
return timeParts.join(":");
376+
};
377+
378+
return (
379+
<View style={{backgroundColor: "#F1F1F1", alignItems: "center", justifyContent: "center"}}>
380+
<Text style={{fontSize: 18, color: "#202020"}}>
381+
{alarmString !== null ? "Alarm set for" : "No alarm set"}
382+
</Text>
383+
<TouchableOpacity
384+
activeOpacity={0.7}
385+
onPress={() => setShowPicker(true)}>
386+
<View style={{alignItems: "center"}}>
387+
{alarmString !== null ? (
388+
<Text style={{color: "#202020", fontSize: 48}}>
389+
{alarmString}
390+
</Text>
391+
) : null}
392+
<TouchableOpacity
393+
activeOpacity={0.7}
394+
onPress={() => setShowPicker(true)}>
395+
<View style={{marginTop: 30}}>
396+
<Text
397+
style={{paddingVertical: 10,
398+
paddingHorizontal: 18,
399+
borderWidth: 1,
400+
borderRadius: 10,
401+
fontSize: 16,
402+
overflow: "hidden",
403+
borderColor: "#8C8C8C",
404+
color: "#8C8C8C"
405+
}}>
406+
Set Alarm 🔔
407+
</Text>
408+
</View>
409+
</TouchableOpacity>
410+
</View>
411+
</TouchableOpacity>
412+
<TimerPickerModal
413+
visible={showPicker}
414+
setIsVisible={setShowPicker}
415+
onConfirm={(pickedDuration) => {
416+
setAlarmString(formatTime(pickedDuration));
417+
setShowPicker(false);
418+
}}
419+
modalTitle="Set Alarm"
420+
onCancel={() => setShowPicker(false)}
421+
closeOnOverlayPress
422+
use12HourPicker
423+
LinearGradient={LinearGradient}
424+
// Custom buttons
425+
cancelButton={<MyCustomButton label="Cancel" />}
426+
confirmButton={<MyCustomButton label="Confirm" />}
427+
styles={{
428+
theme: "light",
429+
}}
430+
/>
431+
</View>
432+
)
433+
434+
```
299435

300436
### Timer Picker with Transparent Fade-Out (Dark Mode) 🌒
301437

438+
<img src="demos/example4.gif" width="250" height="550"/>
439+
302440
```jsx
303441
import { TimerPicker } from "react-native-timer-picker";
304442
import MaskedView from "@react-native-masked-view/masked-view"; // for transparent fade-out
@@ -353,10 +491,10 @@ return (
353491

354492
```
355493

356-
<img src="demos/example3.gif" width="250" height="550"/>
357-
358494
### Timer Picker with Customisation (Light Mode) 🌔
359495

496+
<img src="demos/example5.gif" width="250" height="550"/>
497+
360498
```jsx
361499
import { TimerPicker } from "react-native-timer-picker";
362500
import { LinearGradient } from "expo-linear-gradient"; // or `import LinearGradient from "react-native-linear-gradient"`
@@ -397,8 +535,6 @@ return (
397535

398536
```
399537

400-
<img src="demos/example4.gif" width="250" height="550"/>
401-
402538
<br>
403539

404540
## Props 💅
@@ -531,6 +667,8 @@ The TimerPickerModal component accepts all [TimerPicker props](#timerpicker-️)
531667
| hideCancelButton | Hide the cancel button within the modal | Boolean | false | false |
532668
| confirmButtonText | Text for the confirm button | String | Confirm | false |
533669
| cancelButtonText | Text for the cancel button | String | Cancel | false |
670+
| confirmButton | Custom confirm button component | `ReactElement<{ onPress?: () => void }>` | - | false |
671+
| cancelButton | Custom cancel button component | `ReactElement<{ onPress?: () => void }>` | - | false |
534672
| modalTitle | Title text for the modal | String | - | false |
535673
| modalProps | Props for the main modal component | `React.ComponentProps<typeof Modal>` | - | false |
536674
| containerProps | Props for the main container | `React.ComponentProps<typeof View>` | - | false |

demos/example3.gif

-2.77 MB
Loading

demos/example4.gif

1.86 MB
Loading

demos/example5.gif

1.84 MB
Loading

0 commit comments

Comments
 (0)