From b8490f4811d33bda938c99cca7185894c584d16a Mon Sep 17 00:00:00 2001 From: sieu-db <159281348+sieu-db@users.noreply.github.com> Date: Fri, 27 Dec 2024 11:50:08 +0700 Subject: [PATCH] Support prop ignore reduce motion for bottom sheet (#979) * support prop ignore reduce motion for bottom sheet * support ignore reduce motion for bottom sheet * support ignore reduce motion for bottom sheet --- packages/core/src/components/BottomSheet/BottomSheet.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/core/src/components/BottomSheet/BottomSheet.tsx b/packages/core/src/components/BottomSheet/BottomSheet.tsx index 4d8dd7bb8..da4507fec 100644 --- a/packages/core/src/components/BottomSheet/BottomSheet.tsx +++ b/packages/core/src/components/BottomSheet/BottomSheet.tsx @@ -12,6 +12,7 @@ import BottomSheetComponent, { } from "@gorhom/bottom-sheet"; import { useTheme } from "@draftbit/theme"; import { extractPercentNumber, useDeepCompareMemo } from "../../utilities"; +import { ReduceMotion } from "react-native-reanimated"; type SnapPosition = "top" | "middle" | "bottom"; @@ -38,6 +39,7 @@ export interface BottomSheetProps extends ScrollViewProps { enableDynamicSizing?: boolean; onSettle?: (index: number) => void; style?: StyleProp; + ignoreReduceMotion?: boolean; } // Clarification: @@ -61,6 +63,7 @@ const BottomSheet = React.forwardRef( onSettle, style, children, + ignoreReduceMotion = true, ...rest }, ref @@ -119,6 +122,9 @@ const BottomSheet = React.forwardRef( ? onSettle?.(mappedSnapPoints.length - index) : onSettle?.(mappedSnapPoints.length - index - 1) } + overrideReduceMotion={ + ignoreReduceMotion ? ReduceMotion.Never : ReduceMotion.System + } >