Skip to content

Commit

Permalink
Merge branch 'release-v1.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
troberts-28 committed Jan 9, 2024
2 parents 864c1c2 + 800436e commit 98ce784
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ return (
| secondLabel | Label for the seconds picker | String \| React.ReactElement | s | false |
| padWithNItems | Number of items to pad the picker with on either side | Number | 1 | false |
| aggressivelyGetLatestDuration | Set to True to ask DurationScroll to aggressively update the latestDuration ref | Boolean | false | false |
| allowFontScaling | Allow font in the picker to scale with accessibility settings | Boolean | false | false |
| use12HourPicker | Switch the hour picker to 12-hour format with an AM / PM label | Boolean | false | false |
| amLabel | Set the AM label if using the 12-hour picker | String | am | false |
| pmLabel | Set the PM label if using the 12-hour picker | String | pm | false |
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "react-native-timer-picker",
"description": "A simple, flexible, performant duration picker for Expo React Native apps 🔥\n\nGreat for timers, alarms and duration inputs ⏰🕰️⏳",
"description": "A simple, flexible, performant duration picker for React Native apps 🔥\n\nGreat for timers, alarms and duration inputs ⏰🕰️⏳",
"author": {
"name": "Tim Roberts",
"url": "https://github.com/troberts-28"
},
"license": "MIT",
"version": "1.4.0",
"version": "1.5.0",
"main": "dist/commonjs/index.js",
"types": "dist/typescript/src/index.d.ts",
"scripts": {
Expand Down
14 changes: 12 additions & 2 deletions src/components/TimerPicker/DurationScroll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export type LimitType = {
};

interface DurationScrollProps {
allowFontScaling?: boolean;
numberOfItems: number;
label?: string | React.ReactElement;
initialValue?: number;
Expand Down Expand Up @@ -83,6 +84,7 @@ const DurationScroll = forwardRef<DurationScrollRef, DurationScrollProps>(
disableInfiniteScroll = false,
limit,
aggressivelyGetLatestDuration,
allowFontScaling = false,
is12HourPicker,
amLabel,
pmLabel,
Expand Down Expand Up @@ -166,6 +168,7 @@ const DurationScroll = forwardRef<DurationScrollRef, DurationScrollProps>(
style={styles.pickerItemContainer}
testID="picker-item">
<Text
allowFontScaling={allowFontScaling}
style={[
styles.pickerItem,
intItem > adjustedLimited.max ||
Expand All @@ -179,7 +182,9 @@ const DurationScroll = forwardRef<DurationScrollRef, DurationScrollProps>(
<View
style={styles.pickerAmPmContainer}
pointerEvents="none">
<Text style={[styles.pickerAmPmLabel]}>
<Text
style={[styles.pickerAmPmLabel]}
allowFontScaling={allowFontScaling}>
{isAm ? amLabel : pmLabel}
</Text>
</View>
Expand All @@ -190,6 +195,7 @@ const DurationScroll = forwardRef<DurationScrollRef, DurationScrollProps>(
[
adjustedLimited.max,
adjustedLimited.min,
allowFontScaling,
amLabel,
is12HourPicker,
pmLabel,
Expand Down Expand Up @@ -364,7 +370,11 @@ const DurationScroll = forwardRef<DurationScrollRef, DurationScrollProps>(
/>
<View style={styles.pickerLabelContainer} pointerEvents="none">
{typeof label === "string" ? (
<Text style={styles.pickerLabel}>{label}</Text>
<Text
allowFontScaling={allowFontScaling}
style={styles.pickerLabel}>
{label}
</Text>
) : (
label ?? null
)}
Expand Down
5 changes: 5 additions & 0 deletions src/components/TimerPicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface TimerPickerRef {
}

export interface TimerPickerProps {
allowFontScaling?: boolean;
onDurationChange?: (duration: {
hours: number;
minutes: number;
Expand Down Expand Up @@ -67,6 +68,7 @@ export interface TimerPickerProps {
const TimerPicker = forwardRef<TimerPickerRef, TimerPickerProps>(
(
{
allowFontScaling = false,
onDurationChange,
initialHours = 0,
initialMinutes = 0,
Expand Down Expand Up @@ -167,6 +169,7 @@ const TimerPicker = forwardRef<TimerPickerRef, TimerPickerProps>(
hourLabel ?? (!use12HourPicker ? "h" : undefined)
}
initialValue={initialHours}
allowFontScaling={allowFontScaling}
aggressivelyGetLatestDuration={
aggressivelyGetLatestDuration
}
Expand Down Expand Up @@ -195,6 +198,7 @@ const TimerPicker = forwardRef<TimerPickerRef, TimerPickerProps>(
numberOfItems={59}
label={minuteLabel ?? "m"}
initialValue={initialMinutes}
allowFontScaling={allowFontScaling}
aggressivelyGetLatestDuration={
aggressivelyGetLatestDuration
}
Expand All @@ -221,6 +225,7 @@ const TimerPicker = forwardRef<TimerPickerRef, TimerPickerProps>(
numberOfItems={59}
label={secondLabel ?? "s"}
initialValue={initialSeconds}
allowFontScaling={allowFontScaling}
aggressivelyGetLatestDuration={
aggressivelyGetLatestDuration
}
Expand Down
17 changes: 9 additions & 8 deletions src/components/TimerPickerModal.styles.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { StyleSheet } from "react-native";
import { StyleSheet, Text, View } from "react-native";

import type { CustomTimerPickerStyles } from "./TimerPicker/TimerPicker.styles";
import { ComponentProps } from "react";

export interface CustomTimerPickerModalStyles extends CustomTimerPickerStyles {
container?: any;
contentContainer?: any;
buttonContainer?: any;
button?: any;
cancelButton?: any;
confirmButton?: any;
modalTitle?: any;
container?: ComponentProps<typeof View>;
contentContainer?: ComponentProps<typeof View>;
buttonContainer?: ComponentProps<typeof View>;
button?: ComponentProps<typeof Text>;
cancelButton?: ComponentProps<typeof Text>;
confirmButton?: ComponentProps<typeof Text>;
modalTitle?: ComponentProps<typeof Text>;
}

const DARK_MODE_BACKGROUND_COLOR = "#232323";
Expand Down
2 changes: 2 additions & 0 deletions src/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const TimerPickerModal = forwardRef<TimerPickerModalRef, TimerPickerModalProps>(
secondLabel,
padWithNItems = 1,
disableInfiniteScroll = false,
allowFontScaling = false,
use12HourPicker,
amLabel,
pmLabel,
Expand Down Expand Up @@ -219,6 +220,7 @@ const TimerPickerModal = forwardRef<TimerPickerModalRef, TimerPickerModalProps>(
secondLabel={secondLabel}
padWithNItems={padWithNItems}
disableInfiniteScroll={disableInfiniteScroll}
allowFontScaling={allowFontScaling}
use12HourPicker={use12HourPicker}
amLabel={amLabel}
pmLabel={pmLabel}
Expand Down

0 comments on commit 98ce784

Please sign in to comment.