Skip to content

Commit 98ce784

Browse files
committed
Merge branch 'release-v1.5.0'
2 parents 864c1c2 + 800436e commit 98ce784

File tree

6 files changed

+31
-12
lines changed

6 files changed

+31
-12
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ return (
333333
| secondLabel | Label for the seconds picker | String \| React.ReactElement | s | false |
334334
| padWithNItems | Number of items to pad the picker with on either side | Number | 1 | false |
335335
| aggressivelyGetLatestDuration | Set to True to ask DurationScroll to aggressively update the latestDuration ref | Boolean | false | false |
336+
| allowFontScaling | Allow font in the picker to scale with accessibility settings | Boolean | false | false |
336337
| use12HourPicker | Switch the hour picker to 12-hour format with an AM / PM label | Boolean | false | false |
337338
| amLabel | Set the AM label if using the 12-hour picker | String | am | false |
338339
| pmLabel | Set the PM label if using the 12-hour picker | String | pm | false |

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "react-native-timer-picker",
3-
"description": "A simple, flexible, performant duration picker for Expo React Native apps 🔥\n\nGreat for timers, alarms and duration inputs ⏰🕰️⏳",
3+
"description": "A simple, flexible, performant duration picker for React Native apps 🔥\n\nGreat for timers, alarms and duration inputs ⏰🕰️⏳",
44
"author": {
55
"name": "Tim Roberts",
66
"url": "https://github.com/troberts-28"
77
},
88
"license": "MIT",
9-
"version": "1.4.0",
9+
"version": "1.5.0",
1010
"main": "dist/commonjs/index.js",
1111
"types": "dist/typescript/src/index.d.ts",
1212
"scripts": {

src/components/TimerPicker/DurationScroll.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export type LimitType = {
4848
};
4949

5050
interface DurationScrollProps {
51+
allowFontScaling?: boolean;
5152
numberOfItems: number;
5253
label?: string | React.ReactElement;
5354
initialValue?: number;
@@ -83,6 +84,7 @@ const DurationScroll = forwardRef<DurationScrollRef, DurationScrollProps>(
8384
disableInfiniteScroll = false,
8485
limit,
8586
aggressivelyGetLatestDuration,
87+
allowFontScaling = false,
8688
is12HourPicker,
8789
amLabel,
8890
pmLabel,
@@ -166,6 +168,7 @@ const DurationScroll = forwardRef<DurationScrollRef, DurationScrollProps>(
166168
style={styles.pickerItemContainer}
167169
testID="picker-item">
168170
<Text
171+
allowFontScaling={allowFontScaling}
169172
style={[
170173
styles.pickerItem,
171174
intItem > adjustedLimited.max ||
@@ -179,7 +182,9 @@ const DurationScroll = forwardRef<DurationScrollRef, DurationScrollProps>(
179182
<View
180183
style={styles.pickerAmPmContainer}
181184
pointerEvents="none">
182-
<Text style={[styles.pickerAmPmLabel]}>
185+
<Text
186+
style={[styles.pickerAmPmLabel]}
187+
allowFontScaling={allowFontScaling}>
183188
{isAm ? amLabel : pmLabel}
184189
</Text>
185190
</View>
@@ -190,6 +195,7 @@ const DurationScroll = forwardRef<DurationScrollRef, DurationScrollProps>(
190195
[
191196
adjustedLimited.max,
192197
adjustedLimited.min,
198+
allowFontScaling,
193199
amLabel,
194200
is12HourPicker,
195201
pmLabel,
@@ -364,7 +370,11 @@ const DurationScroll = forwardRef<DurationScrollRef, DurationScrollProps>(
364370
/>
365371
<View style={styles.pickerLabelContainer} pointerEvents="none">
366372
{typeof label === "string" ? (
367-
<Text style={styles.pickerLabel}>{label}</Text>
373+
<Text
374+
allowFontScaling={allowFontScaling}
375+
style={styles.pickerLabel}>
376+
{label}
377+
</Text>
368378
) : (
369379
label ?? null
370380
)}

src/components/TimerPicker/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface TimerPickerRef {
3232
}
3333

3434
export interface TimerPickerProps {
35+
allowFontScaling?: boolean;
3536
onDurationChange?: (duration: {
3637
hours: number;
3738
minutes: number;
@@ -67,6 +68,7 @@ export interface TimerPickerProps {
6768
const TimerPicker = forwardRef<TimerPickerRef, TimerPickerProps>(
6869
(
6970
{
71+
allowFontScaling = false,
7072
onDurationChange,
7173
initialHours = 0,
7274
initialMinutes = 0,
@@ -167,6 +169,7 @@ const TimerPicker = forwardRef<TimerPickerRef, TimerPickerProps>(
167169
hourLabel ?? (!use12HourPicker ? "h" : undefined)
168170
}
169171
initialValue={initialHours}
172+
allowFontScaling={allowFontScaling}
170173
aggressivelyGetLatestDuration={
171174
aggressivelyGetLatestDuration
172175
}
@@ -195,6 +198,7 @@ const TimerPicker = forwardRef<TimerPickerRef, TimerPickerProps>(
195198
numberOfItems={59}
196199
label={minuteLabel ?? "m"}
197200
initialValue={initialMinutes}
201+
allowFontScaling={allowFontScaling}
198202
aggressivelyGetLatestDuration={
199203
aggressivelyGetLatestDuration
200204
}
@@ -221,6 +225,7 @@ const TimerPicker = forwardRef<TimerPickerRef, TimerPickerProps>(
221225
numberOfItems={59}
222226
label={secondLabel ?? "s"}
223227
initialValue={initialSeconds}
228+
allowFontScaling={allowFontScaling}
224229
aggressivelyGetLatestDuration={
225230
aggressivelyGetLatestDuration
226231
}

src/components/TimerPickerModal.styles.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
import { StyleSheet } from "react-native";
2+
import { StyleSheet, Text, View } from "react-native";
33

44
import type { CustomTimerPickerStyles } from "./TimerPicker/TimerPicker.styles";
5+
import { ComponentProps } from "react";
56

67
export interface CustomTimerPickerModalStyles extends CustomTimerPickerStyles {
7-
container?: any;
8-
contentContainer?: any;
9-
buttonContainer?: any;
10-
button?: any;
11-
cancelButton?: any;
12-
confirmButton?: any;
13-
modalTitle?: any;
8+
container?: ComponentProps<typeof View>;
9+
contentContainer?: ComponentProps<typeof View>;
10+
buttonContainer?: ComponentProps<typeof View>;
11+
button?: ComponentProps<typeof Text>;
12+
cancelButton?: ComponentProps<typeof Text>;
13+
confirmButton?: ComponentProps<typeof Text>;
14+
modalTitle?: ComponentProps<typeof Text>;
1415
}
1516

1617
const DARK_MODE_BACKGROUND_COLOR = "#232323";

src/components/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ const TimerPickerModal = forwardRef<TimerPickerModalRef, TimerPickerModalProps>(
8383
secondLabel,
8484
padWithNItems = 1,
8585
disableInfiniteScroll = false,
86+
allowFontScaling = false,
8687
use12HourPicker,
8788
amLabel,
8889
pmLabel,
@@ -219,6 +220,7 @@ const TimerPickerModal = forwardRef<TimerPickerModalRef, TimerPickerModalProps>(
219220
secondLabel={secondLabel}
220221
padWithNItems={padWithNItems}
221222
disableInfiniteScroll={disableInfiniteScroll}
223+
allowFontScaling={allowFontScaling}
222224
use12HourPicker={use12HourPicker}
223225
amLabel={amLabel}
224226
pmLabel={pmLabel}

0 commit comments

Comments
 (0)