Skip to content

Commit b8d5cd4

Browse files
committed
fix: toggling enableContentPanningGesture causing remount of children
1 parent d12f3f7 commit b8d5cd4

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/components/bottomSheet/BottomSheetContent.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { memo, useMemo } from 'react';
22
import type { ViewProps, ViewStyle } from 'react-native';
3-
import Animated, {
3+
import {
44
type AnimatedStyle,
55
useAnimatedStyle,
66
useDerivedValue,
@@ -14,7 +14,6 @@ import { useBottomSheetInternal } from '../../hooks';
1414
import type { NullableAccessibilityProps } from '../../types';
1515
import { animate } from '../../utilities';
1616
import BottomSheetDraggableView from '../bottomSheetDraggableView';
17-
import {} from './constants';
1817
import type { BottomSheetProps } from './types';
1918

2019
type BottomSheetContent = {
@@ -45,7 +44,6 @@ function BottomSheetContentComponent({
4544
const {
4645
enableDynamicSizing,
4746
overDragResistanceFactor,
48-
enableContentPanningGesture,
4947
animatedPosition,
5048
animatedLayoutState,
5149
animatedDetentsState,
@@ -234,19 +232,16 @@ function BottomSheetContentComponent({
234232
//#endregion
235233

236234
//#region render
237-
const DraggableView = enableContentPanningGesture
238-
? BottomSheetDraggableView
239-
: Animated.View;
240235
return (
241-
<DraggableView
236+
<BottomSheetDraggableView
242237
accessible={accessible}
243238
accessibilityLabel={accessibilityLabel}
244239
accessibilityHint={accessibilityHint}
245240
accessibilityRole={accessibilityRole}
246241
style={contentContainerStyle}
247242
>
248243
{children}
249-
</DraggableView>
244+
</BottomSheetDraggableView>
250245
);
251246
//#endregion
252247
}

src/components/bottomSheetDraggableView/BottomSheetDraggableView.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useMemo, memo } from 'react';
1+
import React, { memo, useMemo } from 'react';
22
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
33
import Animated from 'react-native-reanimated';
44
import { BottomSheetDraggableContext } from '../../contexts/gesture';
@@ -108,7 +108,9 @@ const BottomSheetDraggableViewComponent = ({
108108

109109
return (
110110
<GestureDetector gesture={draggableGesture}>
111-
<BottomSheetDraggableContext.Provider value={draggableGesture}>
111+
<BottomSheetDraggableContext.Provider
112+
value={enableContentPanningGesture ? draggableGesture : null}
113+
>
112114
<Animated.View style={style} {...rest}>
113115
{children}
114116
</Animated.View>

0 commit comments

Comments
 (0)