Skip to content

Commit

Permalink
fix: picker & DatePicker onConfirm failed (#1601)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyatong authored Nov 9, 2023
1 parent 81dc498 commit cdd56d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/packages/picker/pickerpanel.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React, {
useImperativeHandle,
} from 'react'
import { PickerOption } from './types'
import { useTouch } from '../../utils/use-touch'
import { useTouch } from '@/utils/use-touch'
import { getRectByTaro } from '@/utils/get-rect-by-taro'
import { passiveSupported } from '@/utils/supports-passive'

Expand Down
6 changes: 2 additions & 4 deletions src/packages/picker/pickerpanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ const InternalPickerPanel: ForwardRefRenderFunction<
}

const setChooseValue = (move: number) => {
chooseItem &&
chooseItem(options?.[Math.round(-move / lineSpacing)], keyIndex)
chooseItem?.(options?.[Math.round(-move / lineSpacing)], keyIndex)
}

// 开始滚动
Expand All @@ -136,7 +135,7 @@ const InternalPickerPanel: ForwardRefRenderFunction<
setMove(move)
}

const touchEnd = (event: React.TouchEvent<HTMLElement>) => {
const touchEnd = () => {
if (!moving.current) return
const move = touch.deltaY.current - startY
const moveTime = Date.now() - startTime
Expand All @@ -149,7 +148,6 @@ const InternalPickerPanel: ForwardRefRenderFunction<
setMove(move, 'end')
}
setTimeout(() => {
// moving.current = false
touch.reset()
}, 0)
}
Expand Down

0 comments on commit cdd56d7

Please sign in to comment.