Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/components/bottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1866,9 +1866,6 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
//#endregion

// render
const DraggableView = enableContentPanningGesture
? BottomSheetDraggableView
: Animated.View;
return (
<BottomSheetProvider value={externalContextVariables}>
<BottomSheetInternalProvider value={internalContextVariables}>
Expand Down Expand Up @@ -1906,12 +1903,13 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
accessibilityRole={_providedAccessibilityRole ?? undefined}
accessibilityLabel={_providedAccessibilityLabel ?? undefined}
>
<DraggableView
<BottomSheetDraggableView
key="BottomSheetRootDraggableView"
style={contentContainerStyle}
enabled={enableContentPanningGesture}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont think we need to pass it as props, as it is already read internally from useBottomSheetInternal

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary so that BottomSheetDraggableView can also be used when enableContentPanningGesture of the BottomSheet is set to false, see PR description.

I've added an example DraggableViewExample which showcases the usage.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm i see, i think for scalability , i would move the enableContentPanningGesture to each scrollable view instead. but we could go ahead with this temporary solution

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, in my case I need to wrap an external component so the solution of this MR would work better for me...

>
{children}
</DraggableView>
</BottomSheetDraggableView>
{footerComponent && (
<BottomSheetFooterContainer
footerComponent={footerComponent}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ const BottomSheetDraggableViewComponent = ({
refreshControlGestureRef,
style,
children,
enabled = true,
...rest
}: BottomSheetDraggableViewProps) => {
//#region hooks
const {
enableContentPanningGesture,
simultaneousHandlers: _providedSimultaneousHandlers,
waitFor,
activeOffsetX,
Expand Down Expand Up @@ -56,7 +56,7 @@ const BottomSheetDraggableViewComponent = ({
]);
const draggableGesture = useMemo(() => {
let gesture = Gesture.Pan()
.enabled(enableContentPanningGesture)
.enabled(enabled)
.shouldCancelWhenOutside(false)
.runOnJS(false)
.onStart(contentPanGestureHandler.handleOnStart)
Expand Down Expand Up @@ -94,7 +94,7 @@ const BottomSheetDraggableViewComponent = ({
}, [
activeOffsetX,
activeOffsetY,
enableContentPanningGesture,
enabled,
failOffsetX,
failOffsetY,
simultaneousHandlers,
Expand Down
1 change: 1 addition & 0 deletions src/components/bottomSheetDraggableView/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export type BottomSheetDraggableViewProps = RNViewProps & {
nativeGestureRef?: Exclude<GestureRef, number>;
refreshControlGestureRef?: Exclude<GestureRef, number>;
children: ReactNode[] | ReactNode;
enabled?: boolean
};