Skip to content

Commit b8490f4

Browse files
authored
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
1 parent 395252c commit b8490f4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/core/src/components/BottomSheet/BottomSheet.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import BottomSheetComponent, {
1212
} from "@gorhom/bottom-sheet";
1313
import { useTheme } from "@draftbit/theme";
1414
import { extractPercentNumber, useDeepCompareMemo } from "../../utilities";
15+
import { ReduceMotion } from "react-native-reanimated";
1516

1617
type SnapPosition = "top" | "middle" | "bottom";
1718

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

4345
// Clarification:
@@ -61,6 +63,7 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
6163
onSettle,
6264
style,
6365
children,
66+
ignoreReduceMotion = true,
6467
...rest
6568
},
6669
ref
@@ -119,6 +122,9 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
119122
? onSettle?.(mappedSnapPoints.length - index)
120123
: onSettle?.(mappedSnapPoints.length - index - 1)
121124
}
125+
overrideReduceMotion={
126+
ignoreReduceMotion ? ReduceMotion.Never : ReduceMotion.System
127+
}
122128
>
123129
<BottomSheetScrollView
124130
contentContainerStyle={[styles.contentContainerStyle, style]}

0 commit comments

Comments
 (0)