修改日历组件下滑位置

This commit is contained in:
筱野
2025-11-14 15:50:00 +08:00
parent 12d597aec2
commit b13979c4ab
9 changed files with 336 additions and 34 deletions

View File

@@ -68,7 +68,7 @@ const CommonPopup: React.FC<CommonPopupProps> = ({
// 只允许向下拖动,限制最大拖动距离
if (deltaY > 0) {
setDragOffset(Math.min(deltaY, 200))
setDragOffset(Math.min(deltaY, 100))
}
}
@@ -78,7 +78,7 @@ const CommonPopup: React.FC<CommonPopupProps> = ({
setIsDragging(false)
// 如果拖动距离超过阈值,关闭弹窗
if (dragOffset > 100) {
if (dragOffset > 50) {
onClose()
}
@@ -100,7 +100,10 @@ const CommonPopup: React.FC<CommonPopupProps> = ({
}}
>
{enableDragToClose && (
<View className={styles['common-popup__drag-handle-container']}>
<View className={styles['common-popup__drag-handle-container']}
onTouchStart={handleTouchStart}
onTouchMove={handleTouchMove}
onTouchEnd={handleTouchEnd}>
<View
className={styles['common-popup__drag-handle']}
style={{
@@ -108,9 +111,7 @@ const CommonPopup: React.FC<CommonPopupProps> = ({
opacity: isDragging ? 0.8 : 1,
transition: isDragging ? 'none' : 'all 0.3s ease-out'
}}
onTouchStart={handleTouchStart}
onTouchMove={handleTouchMove}
onTouchEnd={handleTouchEnd}
/>
</View>
)}

View File

@@ -12,16 +12,20 @@
position: absolute;
top: 6px;
left: 50%;
width: 32px;
height: 4px;
background-color: rgba(22, 24, 35, 0.2);
border-radius: 2px;
width: 90px;
height: 30px;
z-index: 10;
cursor: pointer;
transition: background-color 0.2s ease;
&:active {
background-color: #9ca3af;
display: flex;
justify-content: center;
align-items: flex-start;
&::before{
content: '';
width: 32px;
height: 4px;
background-color: rgba(22, 24, 35, 0.2);
border-radius: 2px;
}
}