Skip to content

Commit 84a3fe9

Browse files
authored
Support ignore reduce motion for bottom sheet - 50 (#980)
* support ignore reduce motion for bottom sheet * support ignore reduce motion for bottom sheet
1 parent 45674ff commit 84a3fe9

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@draftbit/react-theme-provider": "^2.1.1",
4545
"@draftbit/theme": "50.7.0",
4646
"@expo/vector-icons": "^14.0.0",
47-
"@gorhom/bottom-sheet": "5.0.0-alpha.7",
47+
"@gorhom/bottom-sheet": "5.0.6",
4848
"@lottiefiles/react-lottie-player": "3.5.3",
4949
"@material-ui/core": "^4.11.0",
5050
"@material-ui/pickers": "^3.2.10",

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]}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,10 +1915,10 @@
19151915
fast-deep-equal "^3.1.3"
19161916
supercluster "^7.1.3"
19171917

1918-
"@gorhom/[email protected].0-alpha.7":
1919-
version "5.0.0-alpha.7"
1920-
resolved "https://registry.yarnpkg.com/@gorhom/bottom-sheet/-/bottom-sheet-5.0.0-alpha.7.tgz#bf4e89e3f1a7e43e23d30823b60ff36c155babe5"
1921-
integrity sha512-3Gr97lenMOjhUeExzvo+6zimcxWt5o4dQMWZ+E7b71Huqg9in+v+CrVPHAiR7sjpzjdBXwDhKkxLAH3lFRq2+A==
1918+
"@gorhom/[email protected].6":
1919+
version "5.0.6"
1920+
resolved "https://registry.yarnpkg.com/@gorhom/bottom-sheet/-/bottom-sheet-5.0.6.tgz#f20736502399c7bcf8c73ea09e6b571dc07fe0eb"
1921+
integrity sha512-SI/AhPvgRfnCWN6/+wbE6TXwRE4X8F2fLyE4L/0bRwgE34Zenq585qLT139uEcfCIyovC2swC3ICqQpkmWEcFA==
19221922
dependencies:
19231923
"@gorhom/portal" "1.0.14"
19241924
invariant "^2.2.4"

0 commit comments

Comments
 (0)