File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,10 @@ const InternalPickerRoller: ForwardRefRenderFunction<
107107 onSelect ?.( options ?. [ Math . round ( - move / lineSpacing . current ) ] , keyIndex )
108108 }
109109
110+ const isScroll = useRef ( false )
111+
110112 const handleTouchStart = ( event : React . TouchEvent < HTMLDivElement > ) => {
113+ isScroll . current = true
111114 touch . start ( event )
112115 setStartY ( touch . deltaY . current )
113116 setStartTime ( Date . now ( ) )
@@ -134,6 +137,7 @@ const InternalPickerRoller: ForwardRefRenderFunction<
134137 } else {
135138 handleMove ( move , 'end' )
136139 }
140+ isScroll . current = false
137141 setTimeout ( ( ) => {
138142 touch . reset ( )
139143 } , 0 )
@@ -245,6 +249,12 @@ const InternalPickerRoller: ForwardRefRenderFunction<
245249 handleTouchEnd ,
246250 ] )
247251
252+ const onTransitionEnd = ( ) => {
253+ if ( ! isScroll . current ) {
254+ stopMomentumScroll ( )
255+ }
256+ }
257+
248258 return (
249259 < View className = "nut-pickerview-list" ref = { pickerRollerRef } >
250260 < View
@@ -257,7 +267,7 @@ const InternalPickerRoller: ForwardRefRenderFunction<
257267 id = { `${ classPrefix } -${ uuid } ` }
258268 ref = { rollerRef }
259269 style = { threeDimensional ? touchRollerStyle ( ) : touchTiledStyle ( ) }
260- onTransitionEnd = { stopMomentumScroll }
270+ onTransitionEnd = { onTransitionEnd }
261271 >
262272 { /* 3D 效果 */ }
263273 { threeDimensional &&
You can’t perform that action at this time.
0 commit comments