Skip to content

Commit

Permalink
Support ignore reduce motion for bottom sheet - 50 (#980)
Browse files Browse the repository at this point in the history
* 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 45674ff commit 84a3fe9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
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
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1915,10 +1915,10 @@
fast-deep-equal "^3.1.3"
supercluster "^7.1.3"

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

0 comments on commit 84a3fe9

Please sign in to comment.