Skip to content

Commit 2305180

Browse files
committed
Fix drag bug
1 parent da2a34d commit 2305180

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/DraggablePanel.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,13 @@ export const DraggablePanel = React.forwardRef((props: Props, ref) => {
119119
};
120120

121121
const onMomentumScrollEnd = (e: NativeSyntheticEvent<NativeScrollEvent>) => {
122-
if (e.nativeEvent.contentOffset.y !== 0 && props.expandable) {
123-
setInnerContentHeight(height);
122+
if (props.expandable) {
123+
const {y} = e.nativeEvent.contentOffset;
124+
if (y !== 0) {
125+
setInnerContentHeight(height);
126+
} else {
127+
setInnerContentHeight(DEFAULT_PANEL_HEIGHT);
128+
}
124129
}
125130
};
126131

0 commit comments

Comments
 (0)