From 43f981a929cd5ecc81635456dedbdc84758781aa Mon Sep 17 00:00:00 2001 From: Kyle Edgette Date: Tue, 1 Feb 2022 03:11:34 -0500 Subject: [PATCH] feat: add drawerAllowFontScaling prop to drawer package (#10041) Add `drawerAllowFontScaling` to the drawer options, so consumers can enable or disable font scaling for drawer labels to respect Text Size accessibility settings. The option functions similarly to [`tabBarAllowFontScaling`](tabBarAllowFontScaling). Co-authored-by: Kyle Edgette --- packages/drawer/src/types.tsx | 5 +++++ packages/drawer/src/views/DrawerItem.tsx | 6 ++++++ packages/drawer/src/views/DrawerItemList.tsx | 2 ++ 3 files changed, 13 insertions(+) diff --git a/packages/drawer/src/types.tsx b/packages/drawer/src/types.tsx index aa714e46..9213f91a 100644 --- a/packages/drawer/src/types.tsx +++ b/packages/drawer/src/types.tsx @@ -110,6 +110,11 @@ export type DrawerNavigationOptions = HeaderOptions & { */ drawerInactiveBackgroundColor?: string; + /** + * Whether label font should scale to respect Text Size accessibility settings. + */ + drawerAllowFontScaling?: boolean; + /** * Style object for the single item, which can contain an icon and/or a label. */ diff --git a/packages/drawer/src/views/DrawerItem.tsx b/packages/drawer/src/views/DrawerItem.tsx index 5cab8ef5..5d44203b 100644 --- a/packages/drawer/src/views/DrawerItem.tsx +++ b/packages/drawer/src/views/DrawerItem.tsx @@ -77,6 +77,10 @@ type Props = { * Style object for the wrapper element. */ style?: StyleProp; + /** + * Whether label font should scale to respect Text Size accessibility settings. + */ + allowFontScaling?: boolean; }; const LinkPressable = ({ @@ -141,6 +145,7 @@ export default function DrawerItem(props: Props) { labelStyle, to, focused = false, + allowFontScaling, activeTintColor = colors.primary, inactiveTintColor = Color(colors.text).alpha(0.68).rgb().string(), activeBackgroundColor = Color(activeTintColor).alpha(0.12).rgb().string(), @@ -186,6 +191,7 @@ export default function DrawerItem(props: Props) { {typeof label === 'string' ? (