From 5b82e9f4604301d883cf677a27ce7b1a0eaed58e Mon Sep 17 00:00:00 2001 From: Tim Roberts Date: Tue, 9 Jan 2024 11:24:05 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20add=20the=20ability=20to=20disable/?= =?UTF-8?q?enable=20font=20scaling=20(disabled=20by=20default)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TimerPicker/DurationScroll.tsx | 14 ++++++++++++-- src/components/TimerPicker/index.tsx | 5 +++++ src/components/index.tsx | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/components/TimerPicker/DurationScroll.tsx b/src/components/TimerPicker/DurationScroll.tsx index 753e886..561f553 100644 --- a/src/components/TimerPicker/DurationScroll.tsx +++ b/src/components/TimerPicker/DurationScroll.tsx @@ -48,6 +48,7 @@ export type LimitType = { }; interface DurationScrollProps { + allowFontScaling?: boolean; numberOfItems: number; label?: string | React.ReactElement; initialValue?: number; @@ -83,6 +84,7 @@ const DurationScroll = forwardRef( disableInfiniteScroll = false, limit, aggressivelyGetLatestDuration, + allowFontScaling = false, is12HourPicker, amLabel, pmLabel, @@ -166,6 +168,7 @@ const DurationScroll = forwardRef( style={styles.pickerItemContainer} testID="picker-item"> adjustedLimited.max || @@ -179,7 +182,9 @@ const DurationScroll = forwardRef( - + {isAm ? amLabel : pmLabel} @@ -190,6 +195,7 @@ const DurationScroll = forwardRef( [ adjustedLimited.max, adjustedLimited.min, + allowFontScaling, amLabel, is12HourPicker, pmLabel, @@ -364,7 +370,11 @@ const DurationScroll = forwardRef( /> {typeof label === "string" ? ( - {label} + + {label} + ) : ( label ?? null )} diff --git a/src/components/TimerPicker/index.tsx b/src/components/TimerPicker/index.tsx index 9d9366c..0fd4745 100644 --- a/src/components/TimerPicker/index.tsx +++ b/src/components/TimerPicker/index.tsx @@ -32,6 +32,7 @@ export interface TimerPickerRef { } export interface TimerPickerProps { + allowFontScaling?: boolean; onDurationChange?: (duration: { hours: number; minutes: number; @@ -67,6 +68,7 @@ export interface TimerPickerProps { const TimerPicker = forwardRef( ( { + allowFontScaling = false, onDurationChange, initialHours = 0, initialMinutes = 0, @@ -167,6 +169,7 @@ const TimerPicker = forwardRef( hourLabel ?? (!use12HourPicker ? "h" : undefined) } initialValue={initialHours} + allowFontScaling={allowFontScaling} aggressivelyGetLatestDuration={ aggressivelyGetLatestDuration } @@ -195,6 +198,7 @@ const TimerPicker = forwardRef( numberOfItems={59} label={minuteLabel ?? "m"} initialValue={initialMinutes} + allowFontScaling={allowFontScaling} aggressivelyGetLatestDuration={ aggressivelyGetLatestDuration } @@ -221,6 +225,7 @@ const TimerPicker = forwardRef( numberOfItems={59} label={secondLabel ?? "s"} initialValue={initialSeconds} + allowFontScaling={allowFontScaling} aggressivelyGetLatestDuration={ aggressivelyGetLatestDuration } diff --git a/src/components/index.tsx b/src/components/index.tsx index 1b380b4..f09f7c7 100644 --- a/src/components/index.tsx +++ b/src/components/index.tsx @@ -83,6 +83,7 @@ const TimerPickerModal = forwardRef( secondLabel, padWithNItems = 1, disableInfiniteScroll = false, + allowFontScaling = false, use12HourPicker, amLabel, pmLabel, @@ -219,6 +220,7 @@ const TimerPickerModal = forwardRef( secondLabel={secondLabel} padWithNItems={padWithNItems} disableInfiniteScroll={disableInfiniteScroll} + allowFontScaling={allowFontScaling} use12HourPicker={use12HourPicker} amLabel={amLabel} pmLabel={pmLabel}