Skip to content

Commit 722b8f4

Browse files
committed
feat: make the BottomSheetBackdrop component configurable
1 parent 8476f8b commit 722b8f4

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const BottomSheetBackdropComponent = ({
4040
onPress,
4141
style,
4242
children,
43+
ViewComponent: AnimatedViewComponent = Animated.View,
4344
accessible: _providedAccessible = DEFAULT_ACCESSIBLE,
4445
accessibilityRole: _providedAccessibilityRole = DEFAULT_ACCESSIBILITY_ROLE,
4546
accessibilityLabel: _providedAccessibilityLabel = DEFAULT_ACCESSIBILITY_LABEL,
@@ -136,7 +137,7 @@ const BottomSheetBackdropComponent = ({
136137
//#endregion
137138

138139
const AnimatedView = (
139-
<Animated.View
140+
<AnimatedViewComponent
140141
style={containerStyle}
141142
pointerEvents={pointerEvents}
142143
accessible={_providedAccessible ?? undefined}
@@ -151,7 +152,7 @@ const BottomSheetBackdropComponent = ({
151152
}
152153
>
153154
{children}
154-
</Animated.View>
155+
</AnimatedViewComponent>
155156
);
156157

157158
return pressBehavior !== 'none' ? (

src/components/bottomSheetBackdrop/types.d.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import type { ReactNode } from 'react';
1+
import type { ComponentType, ReactNode } from 'react';
22
import type { ViewProps } from 'react-native';
3+
import type { AnimatedProps } from 'react-native-reanimated';
34
import type {
45
BottomSheetVariables,
56
NullableAccessibilityProps,
@@ -55,4 +56,10 @@ export interface BottomSheetDefaultBackdropProps
5556
* Child component that will be rendered on backdrop.
5657
*/
5758
children?: ReactNode | ReactNode[];
59+
60+
/**
61+
* Optional component that will be used as a backdrop.
62+
* Default is `Reanimated.View`.
63+
*/
64+
ViewComponent?: ComponentType<AnimatedProps<ViewProps>>;
5865
}

0 commit comments

Comments
 (0)