From 84a3fe992bfaa203888bce45990104197308f728 Mon Sep 17 00:00:00 2001 From: sieu-db <159281348+sieu-db@users.noreply.github.com> Date: Fri, 27 Dec 2024 11:50:11 +0700 Subject: [PATCH] Support ignore reduce motion for bottom sheet - 50 (#980) * support ignore reduce motion for bottom sheet * support ignore reduce motion for bottom sheet --- packages/core/package.json | 2 +- packages/core/src/components/BottomSheet/BottomSheet.tsx | 6 ++++++ yarn.lock | 8 ++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 33091e361..64e095e8f 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -44,7 +44,7 @@ "@draftbit/react-theme-provider": "^2.1.1", "@draftbit/theme": "50.7.0", "@expo/vector-icons": "^14.0.0", - "@gorhom/bottom-sheet": "5.0.0-alpha.7", + "@gorhom/bottom-sheet": "5.0.6", "@lottiefiles/react-lottie-player": "3.5.3", "@material-ui/core": "^4.11.0", "@material-ui/pickers": "^3.2.10", 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 + } >