Skip to content

Commit

Permalink
Support prop ignore reduce motion for bottom sheet (#979)
Browse files Browse the repository at this point in the history
* support prop ignore reduce motion for bottom sheet

* support ignore reduce motion for bottom sheet

* support ignore reduce motion for bottom sheet
  • Loading branch information
sieu-db authored Dec 27, 2024
1 parent 395252c commit b8490f4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/core/src/components/BottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -38,6 +39,7 @@ export interface BottomSheetProps extends ScrollViewProps {
enableDynamicSizing?: boolean;
onSettle?: (index: number) => void;
style?: StyleProp<ViewStyle>;
ignoreReduceMotion?: boolean;
}

// Clarification:
Expand All @@ -61,6 +63,7 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
onSettle,
style,
children,
ignoreReduceMotion = true,
...rest
},
ref
Expand Down Expand Up @@ -119,6 +122,9 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
? onSettle?.(mappedSnapPoints.length - index)
: onSettle?.(mappedSnapPoints.length - index - 1)
}
overrideReduceMotion={
ignoreReduceMotion ? ReduceMotion.Never : ReduceMotion.System
}
>
<BottomSheetScrollView
contentContainerStyle={[styles.contentContainerStyle, style]}
Expand Down

0 comments on commit b8490f4

Please sign in to comment.