Skip to content

Commit

Permalink
refactor: allow to render component inside default backdrop (#662)
Browse files Browse the repository at this point in the history
* Allow render component inside backdrop

* resolve comments
  • Loading branch information
r0b0t3d authored Oct 3, 2021
1 parent fd4bb8d commit 5df1a1f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const BottomSheetBackdropComponent = ({
enableTouchThrough = DEFAULT_ENABLE_TOUCH_THROUGH,
pressBehavior = DEFAULT_PRESS_BEHAVIOR,
style,
children,
}: BottomSheetDefaultBackdropProps) => {
//#region hooks
const { snapToIndex, close } = useBottomSheet();
Expand Down Expand Up @@ -116,14 +117,18 @@ const BottomSheetBackdropComponent = ({
accessibilityHint={`Tap to ${
typeof pressBehavior === 'string' ? pressBehavior : 'move'
} the Bottom Sheet`}
/>
>
{children}
</Animated.View>
</TapGestureHandler>
) : (
<Animated.View
ref={containerRef}
pointerEvents={pointerEvents}
style={containerStyle}
/>
>
{children}
</Animated.View>
);
};

Expand Down
4 changes: 4 additions & 0 deletions src/components/bottomSheetBackdrop/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@ export interface BottomSheetDefaultBackdropProps
* @default 'close'
*/
pressBehavior?: BackdropPressBehavior;
/**
* Child component that will be rendered on backdrop.
*/
children?: React.ReactNode | React.ReactNode[];
}

0 comments on commit 5df1a1f

Please sign in to comment.