Skip to content

Commit 5df1a1f

Browse files
authored
refactor: allow to render component inside default backdrop (#662)
* Allow render component inside backdrop * resolve comments
1 parent fd4bb8d commit 5df1a1f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const BottomSheetBackdropComponent = ({
3030
enableTouchThrough = DEFAULT_ENABLE_TOUCH_THROUGH,
3131
pressBehavior = DEFAULT_PRESS_BEHAVIOR,
3232
style,
33+
children,
3334
}: BottomSheetDefaultBackdropProps) => {
3435
//#region hooks
3536
const { snapToIndex, close } = useBottomSheet();
@@ -116,14 +117,18 @@ const BottomSheetBackdropComponent = ({
116117
accessibilityHint={`Tap to ${
117118
typeof pressBehavior === 'string' ? pressBehavior : 'move'
118119
} the Bottom Sheet`}
119-
/>
120+
>
121+
{children}
122+
</Animated.View>
120123
</TapGestureHandler>
121124
) : (
122125
<Animated.View
123126
ref={containerRef}
124127
pointerEvents={pointerEvents}
125128
style={containerStyle}
126-
/>
129+
>
130+
{children}
131+
</Animated.View>
127132
);
128133
};
129134

src/components/bottomSheetBackdrop/types.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,8 @@ export interface BottomSheetDefaultBackdropProps
3939
* @default 'close'
4040
*/
4141
pressBehavior?: BackdropPressBehavior;
42+
/**
43+
* Child component that will be rendered on backdrop.
44+
*/
45+
children?: React.ReactNode | React.ReactNode[];
4246
}

0 commit comments

Comments
 (0)