@tarojs/components-react 4.1.12-beta.9 → 4.2.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/components/picker/picker-group.js +40 -101
  2. package/dist/components/picker/picker-group.js.map +1 -1
  3. package/dist/components/refresher/index.js +5 -5
  4. package/dist/components/refresher/index.js.map +1 -1
  5. package/dist/components/scroll-view/index.js +14 -41
  6. package/dist/components/scroll-view/index.js.map +1 -1
  7. package/dist/index.js +1 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/original/components/picker/picker-group.js +40 -101
  10. package/dist/original/components/picker/picker-group.js.map +1 -1
  11. package/dist/original/components/refresher/index.js +5 -5
  12. package/dist/original/components/refresher/index.js.map +1 -1
  13. package/dist/original/components/scroll-view/index.js +14 -41
  14. package/dist/original/components/scroll-view/index.js.map +1 -1
  15. package/dist/original/index.js +1 -2
  16. package/dist/original/index.js.map +1 -1
  17. package/dist/solid/components/picker/picker-group.js +40 -101
  18. package/dist/solid/components/picker/picker-group.js.map +1 -1
  19. package/dist/solid/components/refresher/index.js +5 -5
  20. package/dist/solid/components/refresher/index.js.map +1 -1
  21. package/dist/solid/components/scroll-view/index.js +18 -45
  22. package/dist/solid/components/scroll-view/index.js.map +1 -1
  23. package/dist/solid/index.js +1 -1
  24. package/package.json +6 -6
  25. package/dist/contexts/ScrollElementContext.js +0 -6
  26. package/dist/contexts/ScrollElementContext.js.map +0 -1
  27. package/dist/original/contexts/ScrollElementContext.js +0 -6
  28. package/dist/original/contexts/ScrollElementContext.js.map +0 -1
  29. package/dist/solid/contexts/ScrollElementContext.js +0 -6
  30. package/dist/solid/contexts/ScrollElementContext.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/scroll-view/index.tsx"],"sourcesContent":["import './style/index.scss'\n\nimport { isFunction } from '@tarojs/shared'\nimport classNames from 'classnames'\n\nimport { ScrollElementContext } from '../../contexts/ScrollElementContext'\nimport { createForwardRefComponent, throttle } from '../../utils'\nimport { useEffect, useRef, useState } from '../../utils/hooks'\n\nimport type React from 'react'\n\nfunction easeOutScroll (from = 0, to = 0, callback) {\n if (from === to || typeof from !== 'number') {\n return\n }\n const change = to - from\n const dur = 500\n const sTime = +new Date()\n function linear (t, b, c, d) {\n return (c * t) / d + b\n }\n const isLarger = to >= from\n\n function step () {\n from = linear(+new Date() - sTime, from, change, dur)\n if ((isLarger && from >= to) || (!isLarger && to >= from)) {\n callback(to)\n return\n }\n callback(from)\n requestAnimationFrame(step)\n }\n step()\n}\n\nfunction scrollIntoView (id = '', isHorizontal = false, animated = true, scrollIntoViewAlignment?: ScrollLogicalPosition) {\n document.querySelector(`#${id}`)?.scrollIntoView({\n behavior: animated ? 'smooth' : 'auto',\n block: !isHorizontal ? (scrollIntoViewAlignment || 'center') : 'center',\n inline: isHorizontal ? (scrollIntoViewAlignment || 'start') : 'start'\n })\n}\n\nfunction scrollVertical (container, scrollTop, top, isAnimation) {\n if (isAnimation) {\n easeOutScroll(scrollTop.current, top, pos => {\n if (container.current) container.current.scrollTop = pos\n })\n } else {\n if (container.current) container.current.scrollTop = top\n }\n scrollTop.current = top\n}\n\nfunction scrollHorizontal (container, scrollLeft, left, isAnimation) {\n if (isAnimation) {\n easeOutScroll(scrollLeft.current, left, pos => {\n if (container.current) container.current.scrollLeft = pos\n })\n } else {\n if (container.current) container.current.scrollLeft = left\n }\n scrollLeft.current = left\n}\n\ninterface IProps extends React.HTMLAttributes<HTMLDivElement> {\n scrollX: boolean\n scrollY: boolean\n upperThreshold: number\n lowerThreshold: number\n scrollTop: number\n scrollLeft: number\n scrollIntoView?: string\n scrollIntoViewAlignment?: ScrollLogicalPosition\n scrollWithAnimation: boolean\n enableBackToTop?: boolean\n forwardedRef?: React.MutableRefObject<HTMLDivElement>\n onScrollToUpper: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onScrollToLower: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onScroll: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onScrollStart?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onScrollEnd?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onTouchMove: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onTouchStart?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onTouchEnd?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n showScrollbar?: boolean // 新增参数,默认true\n enhanced?: boolean // 新增参数,默认false\n /** 嵌套滚动:内容在滚动容器中的起始偏移(固定头部等场景) */\n startOffset?: number\n}\n\nfunction ScrollView (props: IProps) {\n const _scrollTop = useRef<any>(null)\n const _scrollLeft = useRef<any>(null)\n const container = useRef<any>(null)\n const scrollEndTimerRef = useRef<NodeJS.Timeout | null>(null)\n const isScrollingRef = useRef<boolean>(false)\n const isInitializedRef = useRef<boolean>(false)\n const [containerHeight, setContainerHeight] = useState(0)\n const onTouchMove = (e) => {\n e.stopPropagation()\n }\n\n const handleScroll = (props: IProps, isInit = false) => {\n // scrollIntoView\n if (\n props.scrollIntoView &&\n typeof props.scrollIntoView === 'string' &&\n document &&\n document.querySelector &&\n document.querySelector(`#${props.scrollIntoView}`)\n ) {\n const isHorizontal = props.scrollX && !props.scrollY\n if (isInit) {\n setTimeout(() => scrollIntoView(props.scrollIntoView, props.scrollWithAnimation, isHorizontal, props.scrollIntoViewAlignment), 500)\n } else {\n scrollIntoView(props.scrollIntoView, props.scrollWithAnimation, isHorizontal, props.scrollIntoViewAlignment)\n }\n } else {\n const isAnimation = !!props.scrollWithAnimation\n // Y 轴滚动\n if (props.scrollY && typeof props.scrollTop === 'number' && props.scrollTop !== _scrollTop.current) {\n setTimeout(() => scrollVertical(container, _scrollTop, props.scrollTop, isAnimation), 10)\n }\n // X 轴滚动\n if (props.scrollX && typeof props.scrollLeft === 'number' && props.scrollLeft !== _scrollLeft.current) {\n setTimeout(() => scrollHorizontal(container, _scrollLeft, props.scrollLeft, isAnimation), 10)\n }\n }\n }\n\n useEffect(() => {\n handleScroll(props, true)\n isInitializedRef.current = true\n }, [])\n\n // 监听 scrollTop、scrollLeft、scrollIntoView 的变化(排除初始化)\n useEffect(() => {\n if (isInitializedRef.current && container.current) {\n handleScroll(props, false)\n }\n }, [props.scrollTop, props.scrollLeft, props.scrollIntoView])\n\n const {\n className,\n style = {},\n onScroll,\n onScrollToUpper,\n onScrollToLower,\n scrollX,\n scrollY,\n showScrollbar = true, // 默认显示滚动条\n enhanced = false // 默认不增强\n } = props\n let { upperThreshold = 50, lowerThreshold = 50 } = props\n const cls = classNames(\n 'taro-scroll',\n {\n 'taro-scroll-view__scroll-x': scrollX,\n 'taro-scroll-view__scroll-y': scrollY,\n 'taro-scroll--hidebar': enhanced === true && showScrollbar === false,\n 'taro-scroll--enhanced': enhanced === true\n },\n className\n )\n upperThreshold = Number(upperThreshold)\n lowerThreshold = Number(lowerThreshold)\n const upperAndLower = e => {\n if (!container.current) return\n const { offsetWidth, offsetHeight, scrollLeft, scrollTop, scrollHeight, scrollWidth } = container.current\n if (\n onScrollToLower &&\n ((props.scrollY && offsetHeight + scrollTop + lowerThreshold >= scrollHeight) ||\n (props.scrollX && offsetWidth + scrollLeft + lowerThreshold >= scrollWidth))\n ) {\n onScrollToLower(e)\n }\n if (\n onScrollToUpper &&\n ((props.scrollY && scrollTop <= upperThreshold) || (props.scrollX && scrollLeft <= upperThreshold))\n ) {\n onScrollToUpper(e)\n }\n }\n const upperAndLowerThrottle = throttle(upperAndLower, 200)\n const _onScroll = e => {\n const { scrollLeft, scrollTop, scrollHeight, scrollWidth } = container.current\n _scrollLeft.current = scrollLeft\n _scrollTop.current = scrollTop\n Object.defineProperty(e, 'detail', {\n enumerable: true,\n writable: true,\n value: {\n scrollLeft,\n scrollTop,\n scrollHeight,\n scrollWidth\n }\n })\n\n // 处理滚动开始\n if (!isScrollingRef.current) {\n isScrollingRef.current = true\n if (props.onScrollStart) {\n props.onScrollStart(e)\n }\n }\n\n // 清除滚动结束定时器\n if (scrollEndTimerRef.current) {\n clearTimeout(scrollEndTimerRef.current)\n scrollEndTimerRef.current = null\n }\n\n // 设置滚动结束定时器(150ms 无滚动事件后触发)\n if (props.onScrollEnd) {\n scrollEndTimerRef.current = setTimeout(() => {\n if (isScrollingRef.current) {\n isScrollingRef.current = false\n props.onScrollEnd?.(e)\n }\n scrollEndTimerRef.current = null\n }, 150)\n }\n\n upperAndLowerThrottle(e)\n onScroll && onScroll(e)\n }\n const _onTouchMove = e => {\n isFunction(props.onTouchMove) ? props.onTouchMove(e) : onTouchMove(e)\n }\n const _onTouchStart = e => {\n if (isFunction(props.onTouchStart)) {\n props.onTouchStart(e)\n }\n }\n const _onTouchEnd = e => {\n if (isFunction(props.onTouchEnd)) {\n props.onTouchEnd(e)\n }\n }\n // 清理定时器\n useEffect(() => {\n return () => {\n if (scrollEndTimerRef.current) {\n clearTimeout(scrollEndTimerRef.current)\n scrollEndTimerRef.current = null\n }\n }\n }, [])\n\n // ScrollElementContext:嵌套滚动时向子组件提供 scrollRef、containerHeight、startOffset\n useEffect(() => {\n const el = container.current\n if (!el) return\n const update = () => {\n if (container.current) {\n setContainerHeight(container.current.clientHeight)\n }\n }\n update()\n const ro = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(update) : null\n if (ro) {\n ro.observe(el)\n return () => ro.disconnect()\n }\n }, [])\n\n const scrollElementContextValue = {\n scrollRef: container,\n containerHeight,\n startOffset: props.startOffset ?? 0,\n }\n\n return (\n <ScrollElementContext.Provider value={scrollElementContextValue}>\n <div\n ref={e => {\n if (e) {\n container.current = e\n if (props.forwardedRef) props.forwardedRef.current = e\n }\n }}\n style={style}\n className={cls}\n onScroll={_onScroll}\n onTouchMove={_onTouchMove}\n onTouchStart={_onTouchStart}\n onTouchEnd={_onTouchEnd}\n >\n {props.children}\n </div>\n </ScrollElementContext.Provider>\n )\n}\n\nexport default createForwardRefComponent(ScrollView)\n"],"names":["easeOutScroll","from","arguments","length","undefined","to","callback","change","dur","sTime","Date","linear","t","b","c","d","isLarger","step","requestAnimationFrame","scrollIntoView","id","isHorizontal","animated","scrollIntoViewAlignment","_a","document","querySelector","behavior","block","inline","scrollVertical","container","scrollTop","top","isAnimation","current","pos","scrollHorizontal","scrollLeft","left","ScrollView","props","_scrollTop","useRef","_scrollLeft","scrollEndTimerRef","isScrollingRef","isInitializedRef","containerHeight","setContainerHeight","useState","onTouchMove","e","stopPropagation","handleScroll","isInit","scrollX","scrollY","setTimeout","scrollWithAnimation","useEffect","className","style","onScroll","onScrollToUpper","onScrollToLower","showScrollbar","enhanced","upperThreshold","lowerThreshold","cls","classNames","Number","upperAndLower","offsetWidth","offsetHeight","scrollHeight","scrollWidth","upperAndLowerThrottle","throttle","_onScroll","Object","defineProperty","enumerable","writable","value","onScrollStart","clearTimeout","onScrollEnd","call","_onTouchMove","isFunction","_onTouchStart","onTouchStart","_onTouchEnd","onTouchEnd","el","update","clientHeight","ro","ResizeObserver","observe","disconnect","scrollElementContextValue","scrollRef","startOffset","_jsx","ScrollElementContext","Provider","children","ref","forwardedRef","createForwardRefComponent"],"mappings":";;;;;;;;AAWA,SAASA,aAAaA,GAA4B;AAAA,EAAA,IAA1BC,IAAI,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,CAAC;AAAA,EAAA,IAAEG,EAAE,GAAAH,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,CAAC;EAAA,IAAEI,QAAQ,GAAAJ,SAAA,CAAAC,MAAA,GAAAD,CAAAA,GAAAA,SAAA,MAAAE,SAAA;EAChD,IAAIH,IAAI,KAAKI,EAAE,IAAI,OAAOJ,IAAI,KAAK,QAAQ,EAAE;AAC3C,IAAA;AACF;AACA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CAAC;AAEpC;AAEA,YAAeG,yBAAyB,CAACxE,UAAU,CAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/scroll-view/index.tsx"],"sourcesContent":["import './style/index.scss'\n\nimport { isFunction } from '@tarojs/shared'\nimport classNames from 'classnames'\n\nimport { createForwardRefComponent, throttle } from '../../utils'\nimport { useEffect, useRef } from '../../utils/hooks'\n\nimport type React from 'react'\n\nfunction easeOutScroll (from = 0, to = 0, callback) {\n if (from === to || typeof from !== 'number') {\n return\n }\n const change = to - from\n const dur = 500\n const sTime = +new Date()\n function linear (t, b, c, d) {\n return (c * t) / d + b\n }\n const isLarger = to >= from\n\n function step () {\n from = linear(+new Date() - sTime, from, change, dur)\n if ((isLarger && from >= to) || (!isLarger && to >= from)) {\n callback(to)\n return\n }\n callback(from)\n requestAnimationFrame(step)\n }\n step()\n}\n\nfunction scrollIntoView (id = '', isHorizontal = false, animated = true, scrollIntoViewAlignment?: ScrollLogicalPosition) {\n document.querySelector(`#${id}`)?.scrollIntoView({\n behavior: animated ? 'smooth' : 'auto',\n block: !isHorizontal ? (scrollIntoViewAlignment || 'center') : 'center',\n inline: isHorizontal ? (scrollIntoViewAlignment || 'start') : 'start'\n })\n}\n\nfunction scrollVertical (container, scrollTop, top, isAnimation) {\n if (isAnimation) {\n easeOutScroll(scrollTop.current, top, pos => {\n if (container.current) container.current.scrollTop = pos\n })\n } else {\n if (container.current) container.current.scrollTop = top\n }\n scrollTop.current = top\n}\n\nfunction scrollHorizontal (container, scrollLeft, left, isAnimation) {\n if (isAnimation) {\n easeOutScroll(scrollLeft.current, left, pos => {\n if (container.current) container.current.scrollLeft = pos\n })\n } else {\n if (container.current) container.current.scrollLeft = left\n }\n scrollLeft.current = left\n}\n\ninterface IProps extends React.HTMLAttributes<HTMLDivElement> {\n scrollX: boolean\n scrollY: boolean\n upperThreshold: number\n lowerThreshold: number\n scrollTop: number\n scrollLeft: number\n scrollIntoView?: string\n scrollIntoViewAlignment?: ScrollLogicalPosition\n scrollWithAnimation: boolean\n enableBackToTop?: boolean\n forwardedRef?: React.MutableRefObject<HTMLDivElement>\n onScrollToUpper: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onScrollToLower: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onScroll: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onScrollStart?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onScrollEnd?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onTouchMove: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onTouchStart?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onTouchEnd?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n showScrollbar?: boolean // 新增参数,默认true\n enhanced?: boolean // 新增参数,默认false\n}\n\nfunction ScrollView (props: IProps) {\n const _scrollTop = useRef<any>(null)\n const _scrollLeft = useRef<any>(null)\n const container = useRef<any>(null)\n const scrollEndTimerRef = useRef<NodeJS.Timeout | null>(null)\n const isScrollingRef = useRef<boolean>(false)\n const isInitializedRef = useRef<boolean>(false)\n const onTouchMove = (e) => {\n e.stopPropagation()\n }\n\n const handleScroll = (props: IProps, isInit = false) => {\n // scrollIntoView\n if (\n props.scrollIntoView &&\n typeof props.scrollIntoView === 'string' &&\n document &&\n document.querySelector &&\n document.querySelector(`#${props.scrollIntoView}`)\n ) {\n const isHorizontal = props.scrollX && !props.scrollY\n if (isInit) {\n setTimeout(() => scrollIntoView(props.scrollIntoView, props.scrollWithAnimation, isHorizontal, props.scrollIntoViewAlignment), 500)\n } else {\n scrollIntoView(props.scrollIntoView, props.scrollWithAnimation, isHorizontal, props.scrollIntoViewAlignment)\n }\n } else {\n const isAnimation = !!props.scrollWithAnimation\n // Y 轴滚动\n if (props.scrollY && typeof props.scrollTop === 'number' && props.scrollTop !== _scrollTop.current) {\n setTimeout(() => scrollVertical(container, _scrollTop, props.scrollTop, isAnimation), 10)\n }\n // X 轴滚动\n if (props.scrollX && typeof props.scrollLeft === 'number' && props.scrollLeft !== _scrollLeft.current) {\n setTimeout(() => scrollHorizontal(container, _scrollLeft, props.scrollLeft, isAnimation), 10)\n }\n }\n }\n\n useEffect(() => {\n handleScroll(props, true)\n isInitializedRef.current = true\n }, [])\n\n // 监听 scrollTop、scrollLeft、scrollIntoView 的变化(排除初始化)\n useEffect(() => {\n if (isInitializedRef.current && container.current) {\n handleScroll(props, false)\n }\n }, [props.scrollTop, props.scrollLeft, props.scrollIntoView])\n\n const {\n className,\n style = {},\n onScroll,\n onScrollToUpper,\n onScrollToLower,\n scrollX,\n scrollY,\n showScrollbar = true, // 默认显示滚动条\n enhanced = false // 默认不增强\n } = props\n let { upperThreshold = 50, lowerThreshold = 50 } = props\n const cls = classNames(\n 'taro-scroll',\n {\n 'taro-scroll-view__scroll-x': scrollX,\n 'taro-scroll-view__scroll-y': scrollY,\n 'taro-scroll--hidebar': enhanced === true && showScrollbar === false,\n 'taro-scroll--enhanced': enhanced === true\n },\n className\n )\n upperThreshold = Number(upperThreshold)\n lowerThreshold = Number(lowerThreshold)\n const upperAndLower = e => {\n if (!container.current) return\n const { offsetWidth, offsetHeight, scrollLeft, scrollTop, scrollHeight, scrollWidth } = container.current\n if (\n onScrollToLower &&\n ((props.scrollY && offsetHeight + scrollTop + lowerThreshold >= scrollHeight) ||\n (props.scrollX && offsetWidth + scrollLeft + lowerThreshold >= scrollWidth))\n ) {\n onScrollToLower(e)\n }\n if (\n onScrollToUpper &&\n ((props.scrollY && scrollTop <= upperThreshold) || (props.scrollX && scrollLeft <= upperThreshold))\n ) {\n onScrollToUpper(e)\n }\n }\n const upperAndLowerThrottle = throttle(upperAndLower, 200)\n const _onScroll = e => {\n const { scrollLeft, scrollTop, scrollHeight, scrollWidth } = container.current\n _scrollLeft.current = scrollLeft\n _scrollTop.current = scrollTop\n Object.defineProperty(e, 'detail', {\n enumerable: true,\n writable: true,\n value: {\n scrollLeft,\n scrollTop,\n scrollHeight,\n scrollWidth\n }\n })\n\n // 处理滚动开始\n if (!isScrollingRef.current) {\n isScrollingRef.current = true\n if (props.onScrollStart) {\n props.onScrollStart(e)\n }\n }\n\n // 清除滚动结束定时器\n if (scrollEndTimerRef.current) {\n clearTimeout(scrollEndTimerRef.current)\n scrollEndTimerRef.current = null\n }\n\n // 设置滚动结束定时器(150ms 无滚动事件后触发)\n if (props.onScrollEnd) {\n scrollEndTimerRef.current = setTimeout(() => {\n if (isScrollingRef.current) {\n isScrollingRef.current = false\n props.onScrollEnd?.(e)\n }\n scrollEndTimerRef.current = null\n }, 150)\n }\n\n upperAndLowerThrottle(e)\n onScroll && onScroll(e)\n }\n const _onTouchMove = e => {\n isFunction(props.onTouchMove) ? props.onTouchMove(e) : onTouchMove(e)\n }\n const _onTouchStart = e => {\n if (isFunction(props.onTouchStart)) {\n props.onTouchStart(e)\n }\n }\n const _onTouchEnd = e => {\n if (isFunction(props.onTouchEnd)) {\n props.onTouchEnd(e)\n }\n }\n // 清理定时器\n useEffect(() => {\n return () => {\n if (scrollEndTimerRef.current) {\n clearTimeout(scrollEndTimerRef.current)\n scrollEndTimerRef.current = null\n }\n }\n }, [])\n\n return (\n <div\n ref={e => {\n if (e) {\n container.current = e\n if (props.forwardedRef) props.forwardedRef.current = e\n }\n }}\n style={style}\n className={cls}\n onScroll={_onScroll}\n onTouchMove={_onTouchMove}\n onTouchStart={_onTouchStart}\n onTouchEnd={_onTouchEnd}\n >\n {props.children}\n </div>\n )\n}\n\nexport default createForwardRefComponent(ScrollView)\n"],"names":["easeOutScroll","from","arguments","length","undefined","to","callback","change","dur","sTime","Date","linear","t","b","c","d","isLarger","step","requestAnimationFrame","scrollIntoView","id","isHorizontal","animated","scrollIntoViewAlignment","_a","document","querySelector","behavior","block","inline","scrollVertical","container","scrollTop","top","isAnimation","current","pos","scrollHorizontal","scrollLeft","left","ScrollView","props","_scrollTop","useRef","_scrollLeft","scrollEndTimerRef","isScrollingRef","isInitializedRef","onTouchMove","e","stopPropagation","handleScroll","isInit","scrollX","scrollY","setTimeout","scrollWithAnimation","useEffect","className","style","onScroll","onScrollToUpper","onScrollToLower","showScrollbar","enhanced","upperThreshold","lowerThreshold","cls","classNames","Number","upperAndLower","offsetWidth","offsetHeight","scrollHeight","scrollWidth","upperAndLowerThrottle","throttle","_onScroll","Object","defineProperty","enumerable","writable","value","onScrollStart","clearTimeout","onScrollEnd","call","_onTouchMove","isFunction","_onTouchStart","onTouchStart","_onTouchEnd","onTouchEnd","_jsx","ref","forwardedRef","children","createForwardRefComponent"],"mappings":";;;;;;;AAUA,SAASA,aAAaA,GAA4B;AAAA,EAAA,IAA1BC,IAAI,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,CAAC;AAAA,EAAA,IAAEG,EAAE,GAAAH,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,CAAC;EAAA,IAAEI,QAAQ,GAAAJ,SAAA,CAAAC,MAAA,GAAAD,CAAAA,GAAAA,SAAA,MAAAE,SAAA;EAChD,IAAIH,IAAI,KAAKI,EAAE,IAAI,OAAOJ,IAAI,KAAK,QAAQ,EAAE;AAC3C,IAAA;AACF;AACA,EAAA,MAAMM,MAAM,GAAGF,EAAE,GAAGJ,IAAI;EACxB,MAAMO,GAAG,GAAG,GAAG;AACf,EAAA,MAAMC,KAAK,GAAG,CAAC,IAAIC,IAAI,EAAE;EACzB,SAASC,MAAMA,CAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAA;AACzB,IAAA,OAAQD,CAAC,GAAGF,CAAC,GAAIG,CAAC,GAAGF,CAAC;AACxB;AACA,EAAA,MAAMG,QAAQ,GAAGX,EAAE,IAAIJ,IAAI;EAE3B,SAASgB,IAAIA,GAAA;AACXhB,IAAA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/index.js CHANGED
@@ -5,8 +5,7 @@ export { default as Image } from './components/image/index.js';
5
5
  export { default as Input } from './components/input/index.js';
6
6
  export { default as Picker } from './components/picker/index.js';
7
7
  export { default as PullDownRefresh } from './components/pull-down-refresh/index.js';
8
- export { Refresher } from './components/refresher/index.js';
9
- export { ScrollElementContext } from './contexts/ScrollElementContext.js';
8
+ export { default as Refresher } from './components/refresher/index.js';
10
9
  export { default as ScrollView } from './components/scroll-view/index.js';
11
10
  export { Swiper, SwiperItem } from './components/swiper/index.js';
12
11
  export { default as Text } from './components/text/index.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.react.ts"],"sourcesContent":["/* eslint-disable simple-import-sort/exports */\nexport { Ad } from '@tarojs/components/lib/react'\nexport { AdCustom } from '@tarojs/components/lib/react'\nexport { AnimationVideo } from '@tarojs/components/lib/react'\nexport { AnimationView } from '@tarojs/components/lib/react'\nexport { ArCamera } from '@tarojs/components/lib/react'\nexport { Audio } from '@tarojs/components/lib/react'\nexport { AwemeData } from '@tarojs/components/lib/react'\nexport { Block } from '@tarojs/components/lib/react'\nexport { default as Button } from './components/button'\nexport { Camera } from '@tarojs/components/lib/react'\nexport { Canvas } from '@tarojs/components/lib/react'\nexport { ChannelLive } from '@tarojs/components/lib/react'\nexport { ChannelVideo } from '@tarojs/components/lib/react'\nexport { Checkbox, CheckboxGroup } from '@tarojs/components/lib/react'\nexport { CommentDetail, CommentList } from '@tarojs/components/lib/react'\nexport { ContactButton } from '@tarojs/components/lib/react'\nexport { CoverImage } from '@tarojs/components/lib/react'\nexport { CoverView } from '@tarojs/components/lib/react'\nexport { CustomWrapper } from '@tarojs/components/lib/react'\nexport { DraggableSheet } from '@tarojs/components/lib/react'\nexport { Editor } from '@tarojs/components/lib/react'\nexport { FollowSwan } from '@tarojs/components/lib/react'\nexport { Form } from '@tarojs/components/lib/react'\nexport { FunctionalPageNavigator } from '@tarojs/components/lib/react'\nexport { GridView } from '@tarojs/components/lib/react'\nexport { GridBuilder } from '@tarojs/components/lib/react'\nexport { default as Icon } from './components/icon'\nexport { default as Image } from './components/image'\nexport { InlinePaymentPanel } from '@tarojs/components/lib/react'\nexport { default as Input } from './components/input'\nexport { KeyboardAccessory } from '@tarojs/components/lib/react'\nexport { Label } from '@tarojs/components/lib/react'\nexport { Lifestyle } from '@tarojs/components/lib/react'\nexport { Like } from '@tarojs/components/lib/react'\nexport { LivePlayer } from '@tarojs/components/lib/react'\nexport { LivePusher } from '@tarojs/components/lib/react'\nexport { ListBuilder } from '@tarojs/components/lib/react'\nexport { ListView } from '@tarojs/components/lib/react'\nexport { Login } from '@tarojs/components/lib/react'\nexport { Lottie } from '@tarojs/components/lib/react'\nexport { Map } from '@tarojs/components/lib/react'\nexport { MatchMedia } from '@tarojs/components/lib/react'\nexport { MovableArea, MovableView } from '@tarojs/components/lib/react'\nexport { NavigationBar } from '@tarojs/components/lib/react'\nexport { Navigator } from '@tarojs/components/lib/react'\nexport { NestedScrollBody } from '@tarojs/components/lib/react'\nexport { NestedScrollHeader } from '@tarojs/components/lib/react'\nexport { OfficialAccount } from '@tarojs/components/lib/react'\nexport { OpenData } from '@tarojs/components/lib/react'\nexport { OpenContainer } from '@tarojs/components/lib/react'\nexport { PageContainer } from '@tarojs/components/lib/react'\nexport { PageMeta } from '@tarojs/components/lib/react'\nexport { default as Picker } from './components/picker'\nexport { PickerView, PickerViewColumn } from '@tarojs/components/lib/react'\nexport { Progress } from '@tarojs/components/lib/react'\nexport { default as PullDownRefresh } from './components/pull-down-refresh'\n// export { PullToRefresh } from '@tarojs/components/lib/react'\nexport { default as Refresher, type RefresherProps } from './components/refresher'\nexport { Radio, RadioGroup } from '@tarojs/components/lib/react'\nexport { RichText } from '@tarojs/components/lib/react'\nexport { RootPortal } from '@tarojs/components/lib/react'\nexport { RtcRoom, RtcRoomItem } from '@tarojs/components/lib/react'\nexport { Script } from '@tarojs/components/lib/react'\nexport { ScrollElementContext, type ScrollElementContextValue } from './contexts/ScrollElementContext'\nexport { default as ScrollView } from './components/scroll-view'\nexport { ShareElement } from '@tarojs/components/lib/react'\nexport { Slider } from '@tarojs/components/lib/react'\nexport { Snapshot } from '@tarojs/components/lib/react'\nexport { Span } from '@tarojs/components/lib/react'\nexport { NativeSlot, Slot } from '@tarojs/components/lib/react'\nexport { Swiper, SwiperItem } from './components/swiper'\nexport { Switch } from '@tarojs/components/lib/react'\nexport { Tabs } from '@tarojs/components/lib/react'\nexport { default as Text } from './components/text'\nexport { Textarea } from '@tarojs/components/lib/react'\nexport { Video } from '@tarojs/components/lib/react'\nexport { default as View } from './components/view'\nexport { VoipRoom } from '@tarojs/components/lib/react'\nexport { WebView } from '@tarojs/components/lib/react'\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.react.ts"],"sourcesContent":["/* eslint-disable simple-import-sort/exports */\nexport { Ad } from '@tarojs/components/lib/react'\nexport { AdCustom } from '@tarojs/components/lib/react'\nexport { AnimationVideo } from '@tarojs/components/lib/react'\nexport { AnimationView } from '@tarojs/components/lib/react'\nexport { ArCamera } from '@tarojs/components/lib/react'\nexport { Audio } from '@tarojs/components/lib/react'\nexport { AwemeData } from '@tarojs/components/lib/react'\nexport { Block } from '@tarojs/components/lib/react'\nexport { default as Button } from './components/button'\nexport { Camera } from '@tarojs/components/lib/react'\nexport { Canvas } from '@tarojs/components/lib/react'\nexport { ChannelLive } from '@tarojs/components/lib/react'\nexport { ChannelVideo } from '@tarojs/components/lib/react'\nexport { Checkbox, CheckboxGroup } from '@tarojs/components/lib/react'\nexport { CommentDetail, CommentList } from '@tarojs/components/lib/react'\nexport { ContactButton } from '@tarojs/components/lib/react'\nexport { CoverImage } from '@tarojs/components/lib/react'\nexport { CoverView } from '@tarojs/components/lib/react'\nexport { CustomWrapper } from '@tarojs/components/lib/react'\nexport { DraggableSheet } from '@tarojs/components/lib/react'\nexport { Editor } from '@tarojs/components/lib/react'\nexport { FollowSwan } from '@tarojs/components/lib/react'\nexport { Form } from '@tarojs/components/lib/react'\nexport { FunctionalPageNavigator } from '@tarojs/components/lib/react'\nexport { GridView } from '@tarojs/components/lib/react'\nexport { GridBuilder } from '@tarojs/components/lib/react'\nexport { default as Icon } from './components/icon'\nexport { default as Image } from './components/image'\nexport { InlinePaymentPanel } from '@tarojs/components/lib/react'\nexport { default as Input } from './components/input'\nexport { KeyboardAccessory } from '@tarojs/components/lib/react'\nexport { Label } from '@tarojs/components/lib/react'\nexport { Lifestyle } from '@tarojs/components/lib/react'\nexport { Like } from '@tarojs/components/lib/react'\nexport { LivePlayer } from '@tarojs/components/lib/react'\nexport { LivePusher } from '@tarojs/components/lib/react'\nexport { ListBuilder } from '@tarojs/components/lib/react'\nexport { ListView } from '@tarojs/components/lib/react'\nexport { Login } from '@tarojs/components/lib/react'\nexport { Lottie } from '@tarojs/components/lib/react'\nexport { Map } from '@tarojs/components/lib/react'\nexport { MatchMedia } from '@tarojs/components/lib/react'\nexport { MovableArea, MovableView } from '@tarojs/components/lib/react'\nexport { NavigationBar } from '@tarojs/components/lib/react'\nexport { Navigator } from '@tarojs/components/lib/react'\nexport { NestedScrollBody } from '@tarojs/components/lib/react'\nexport { NestedScrollHeader } from '@tarojs/components/lib/react'\nexport { OfficialAccount } from '@tarojs/components/lib/react'\nexport { OpenData } from '@tarojs/components/lib/react'\nexport { OpenContainer } from '@tarojs/components/lib/react'\nexport { PageContainer } from '@tarojs/components/lib/react'\nexport { PageMeta } from '@tarojs/components/lib/react'\nexport { default as Picker } from './components/picker'\nexport { PickerView, PickerViewColumn } from '@tarojs/components/lib/react'\nexport { Progress } from '@tarojs/components/lib/react'\nexport { default as PullDownRefresh } from './components/pull-down-refresh'\n// export { PullToRefresh } from '@tarojs/components/lib/react'\nexport { default as Refresher } from './components/refresher'\nexport { Radio, RadioGroup } from '@tarojs/components/lib/react'\nexport { RichText } from '@tarojs/components/lib/react'\nexport { RootPortal } from '@tarojs/components/lib/react'\nexport { RtcRoom, RtcRoomItem } from '@tarojs/components/lib/react'\nexport { Script } from '@tarojs/components/lib/react'\nexport { default as ScrollView } from './components/scroll-view'\nexport { ShareElement } from '@tarojs/components/lib/react'\nexport { Slider } from '@tarojs/components/lib/react'\nexport { Snapshot } from '@tarojs/components/lib/react'\nexport { Span } from '@tarojs/components/lib/react'\nexport { NativeSlot, Slot } from '@tarojs/components/lib/react'\nexport { Swiper, SwiperItem } from './components/swiper'\nexport { Switch } from '@tarojs/components/lib/react'\nexport { Tabs } from '@tarojs/components/lib/react'\nexport { default as Text } from './components/text'\nexport { Textarea } from '@tarojs/components/lib/react'\nexport { Video } from '@tarojs/components/lib/react'\nexport { default as View } from './components/view'\nexport { VoipRoom } from '@tarojs/components/lib/react'\nexport { WebView } from '@tarojs/components/lib/react'\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA"}
@@ -12,43 +12,42 @@ const getIndicatorStyle = lineColor => {
12
12
  borderBottomColor: lineColor
13
13
  };
14
14
  };
15
- // 辅助函数:计算 lengthScaleRatio
16
- const calculateLengthScaleRatio = res => {
17
- let lengthScaleRatio = res === null || res === void 0 ? void 0 : res.lengthScaleRatio;
18
- if (lengthScaleRatio == null || lengthScaleRatio === 0) {
19
- console.warn('Taro.getSystemInfo: lengthScaleRatio 不存在,使用计算值');
20
- lengthScaleRatio = 1;
21
- if (res.windowWidth < 320) {
22
- lengthScaleRatio = res.windowWidth / 320;
23
- } else if (res.windowWidth >= 400 && res.windowWidth < 600) {
24
- lengthScaleRatio = res.windowWidth / 400;
25
- }
26
- const shortSide = res.windowWidth < res.windowHeight ? res.windowWidth : res.windowHeight;
27
- const isBigScreen = shortSide >= 600;
28
- if (isBigScreen) {
29
- lengthScaleRatio = shortSide / 720;
30
- }
31
- }
32
- return lengthScaleRatio;
33
- };
34
15
  // 辅助函数:获取系统信息的 lengthScaleRatio 并设置 targetScrollTop
35
- const setTargetScrollTopWithScale = function (setTargetScrollTop, baseValue, randomOffset) {
36
- let lengthScaleRatio = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
16
+ const setTargetScrollTopWithScale = (setTargetScrollTop, baseValue, randomOffset) => {
37
17
  // H5 和 weapp 不参与放大计算,直接使用 baseValue
38
18
  if (process.env.TARO_ENV === 'h5' || process.env.TARO_ENV === 'weapp') {
39
19
  const finalValue = randomOffset !== undefined ? baseValue + randomOffset : baseValue;
40
20
  setTargetScrollTop(finalValue);
41
21
  return;
42
22
  }
43
- if (process.env.TARO_PLATFORM === 'harmony') {
44
- const scaledValue = baseValue;
45
- const finalValue = randomOffset !== undefined ? scaledValue + randomOffset : scaledValue;
46
- setTargetScrollTop(finalValue);
47
- } else {
48
- const scaledValue = baseValue * lengthScaleRatio;
49
- const finalValue = randomOffset !== undefined ? scaledValue + randomOffset : scaledValue;
50
- setTargetScrollTop(finalValue);
51
- }
23
+ Taro.getSystemInfo({
24
+ success: res => {
25
+ let lengthScaleRatio = res === null || res === void 0 ? void 0 : res.lengthScaleRatio;
26
+ if (lengthScaleRatio == null || lengthScaleRatio === 0) {
27
+ console.warn('Taro.getSystemInfo: lengthScaleRatio 不存在,使用计算值');
28
+ lengthScaleRatio = 1;
29
+ if (res.windowWidth < 320) {
30
+ lengthScaleRatio = res.windowWidth / 320;
31
+ } else if (res.windowWidth >= 400 && res.windowWidth < 600) {
32
+ lengthScaleRatio = res.windowWidth / 400;
33
+ }
34
+ const shortSide = res.windowWidth < res.windowHeight ? res.windowWidth : res.windowHeight;
35
+ const isBigScreen = shortSide >= 600;
36
+ if (isBigScreen) {
37
+ lengthScaleRatio = shortSide / 720;
38
+ }
39
+ }
40
+ const scaledValue = baseValue * lengthScaleRatio;
41
+ const finalValue = randomOffset !== undefined ? scaledValue + randomOffset : scaledValue;
42
+ setTargetScrollTop(finalValue);
43
+ },
44
+ fail: err => {
45
+ console.error('获取系统信息失败:', err);
46
+ // 失败时使用默认值 1
47
+ const finalValue = randomOffset !== undefined ? baseValue + randomOffset : baseValue;
48
+ setTargetScrollTop(finalValue);
49
+ }
50
+ });
52
51
  };
53
52
  function PickerGroupBasic(props) {
54
53
  const {
@@ -69,25 +68,10 @@ function PickerGroupBasic(props) {
69
68
  const [currentIndex, setCurrentIndex] = React.useState(selectedIndex);
70
69
  // 触摸状态用于优化用户体验
71
70
  const [isTouching, setIsTouching] = React.useState(false);
72
- const lengthScaleRatioRef = React.useRef(1);
73
71
  const itemHeightRef = React.useRef(PICKER_LINE_HEIGHT);
74
- // 初始化时计算 lengthScaleRatio
75
- React.useEffect(() => {
76
- Taro.getSystemInfo({
77
- success: res => {
78
- lengthScaleRatioRef.current = calculateLengthScaleRatio(res);
79
- },
80
- fail: () => {
81
- // 失败时使用默认值 1
82
- lengthScaleRatioRef.current = 1;
83
- }
84
- });
85
- }, []);
86
72
  React.useEffect(() => {
87
73
  var _a;
88
- if (process.env.TARO_PLATFORM === 'harmony') {
89
- itemHeightRef.current = PICKER_LINE_HEIGHT * lengthScaleRatioRef.current;
90
- } else {
74
+ if (process.env.TARO_PLATFORM !== 'harmony') {
91
75
  if (scrollViewRef.current && ((_a = scrollViewRef.current) === null || _a === void 0 ? void 0 : _a.scrollHeight)) {
92
76
  itemHeightRef.current = scrollViewRef.current.scrollHeight / scrollViewRef.current.childNodes.length;
93
77
  } else {
@@ -103,7 +87,7 @@ function PickerGroupBasic(props) {
103
87
  React.useEffect(() => {
104
88
  if (scrollViewRef.current && range.length > 0 && !isTouching) {
105
89
  const baseValue = selectedIndex * itemHeightRef.current;
106
- setTargetScrollTopWithScale(setTargetScrollTop, baseValue, undefined, lengthScaleRatioRef.current);
90
+ setTargetScrollTopWithScale(setTargetScrollTop, baseValue);
107
91
  setCurrentIndex(selectedIndex);
108
92
  }
109
93
  }, [selectedIndex, range]);
@@ -124,7 +108,7 @@ function PickerGroupBasic(props) {
124
108
  setIsTouching(false);
125
109
  const baseValue = newIndex * itemHeightRef.current;
126
110
  const randomOffset = Math.random() * 0.001; // 随机数为了在一个项内滚动时强制刷新
127
- setTargetScrollTopWithScale(setTargetScrollTop, baseValue, randomOffset, lengthScaleRatioRef.current);
111
+ setTargetScrollTopWithScale(setTargetScrollTop, baseValue, randomOffset);
128
112
  updateIndex(newIndex, columnId);
129
113
  onColumnChange === null || onColumnChange === void 0 ? void 0 : onColumnChange({
130
114
  columnId,
@@ -213,25 +197,10 @@ function PickerGroupTime(props) {
213
197
  const itemRefs = React.useRef([]);
214
198
  const [currentIndex, setCurrentIndex] = React.useState(selectedIndex);
215
199
  const [isTouching, setIsTouching] = React.useState(false);
216
- const lengthScaleRatioRef = React.useRef(1);
217
200
  const itemHeightRef = React.useRef(PICKER_LINE_HEIGHT);
218
- // 初始化时计算 lengthScaleRatio
219
- React.useEffect(() => {
220
- Taro.getSystemInfo({
221
- success: res => {
222
- lengthScaleRatioRef.current = calculateLengthScaleRatio(res);
223
- },
224
- fail: () => {
225
- // 失败时使用默认值 1
226
- lengthScaleRatioRef.current = 1;
227
- }
228
- });
229
- }, []);
230
201
  React.useEffect(() => {
231
202
  var _a;
232
- if (process.env.TARO_PLATFORM === 'harmony') {
233
- itemHeightRef.current = PICKER_LINE_HEIGHT * lengthScaleRatioRef.current;
234
- } else {
203
+ if (process.env.TARO_PLATFORM !== 'harmony') {
235
204
  if (scrollViewRef.current && ((_a = scrollViewRef.current) === null || _a === void 0 ? void 0 : _a.scrollHeight)) {
236
205
  itemHeightRef.current = scrollViewRef.current.scrollHeight / scrollViewRef.current.childNodes.length;
237
206
  } else {
@@ -246,7 +215,7 @@ function PickerGroupTime(props) {
246
215
  React.useEffect(() => {
247
216
  if (scrollViewRef.current && range.length > 0 && !isTouching) {
248
217
  const baseValue = selectedIndex * itemHeightRef.current;
249
- setTargetScrollTopWithScale(setTargetScrollTop, baseValue, undefined, lengthScaleRatioRef.current);
218
+ setTargetScrollTopWithScale(setTargetScrollTop, baseValue);
250
219
  setCurrentIndex(selectedIndex);
251
220
  }
252
221
  }, [selectedIndex, range]);
@@ -271,7 +240,7 @@ function PickerGroupTime(props) {
271
240
  if (!isLimited) {
272
241
  const baseValue = newIndex * itemHeightRef.current;
273
242
  const randomOffset = Math.random() * 0.001;
274
- setTargetScrollTopWithScale(setTargetScrollTop, baseValue, randomOffset, lengthScaleRatioRef.current);
243
+ setTargetScrollTopWithScale(setTargetScrollTop, baseValue, randomOffset);
275
244
  }
276
245
  isCenterTimerId.current = null;
277
246
  }, 100);
@@ -354,25 +323,10 @@ function PickerGroupDate(props) {
354
323
  const scrollViewRef = React.useRef(null);
355
324
  const [currentIndex, setCurrentIndex] = React.useState(selectedIndex);
356
325
  const [isTouching, setIsTouching] = React.useState(false);
357
- const lengthScaleRatioRef = React.useRef(1);
358
326
  const itemHeightRef = React.useRef(PICKER_LINE_HEIGHT);
359
- // 初始化时计算 lengthScaleRatio
360
- React.useEffect(() => {
361
- Taro.getSystemInfo({
362
- success: res => {
363
- lengthScaleRatioRef.current = calculateLengthScaleRatio(res);
364
- },
365
- fail: () => {
366
- // 失败时使用默认值 1
367
- lengthScaleRatioRef.current = 1;
368
- }
369
- });
370
- }, []);
371
327
  React.useEffect(() => {
372
328
  var _a;
373
- if (process.env.TARO_PLATFORM === 'harmony') {
374
- itemHeightRef.current = PICKER_LINE_HEIGHT * lengthScaleRatioRef.current;
375
- } else {
329
+ if (process.env.TARO_PLATFORM !== 'harmony') {
376
330
  if (scrollViewRef.current && ((_a = scrollViewRef.current) === null || _a === void 0 ? void 0 : _a.scrollHeight)) {
377
331
  itemHeightRef.current = scrollViewRef.current.scrollHeight / scrollViewRef.current.childNodes.length;
378
332
  } else {
@@ -387,7 +341,7 @@ function PickerGroupDate(props) {
387
341
  React.useEffect(() => {
388
342
  if (scrollViewRef.current && range.length > 0 && !isTouching) {
389
343
  const baseValue = selectedIndex * itemHeightRef.current;
390
- setTargetScrollTopWithScale(setTargetScrollTop, baseValue, undefined, lengthScaleRatioRef.current);
344
+ setTargetScrollTopWithScale(setTargetScrollTop, baseValue);
391
345
  setCurrentIndex(selectedIndex);
392
346
  }
393
347
  }, [selectedIndex, range]);
@@ -408,7 +362,7 @@ function PickerGroupDate(props) {
408
362
  setIsTouching(false);
409
363
  const baseValue = newIndex * itemHeightRef.current;
410
364
  const randomOffset = Math.random() * 0.001; // 随机数为了在一个项内滚动时强制刷新
411
- setTargetScrollTopWithScale(setTargetScrollTop, baseValue, randomOffset, lengthScaleRatioRef.current);
365
+ setTargetScrollTopWithScale(setTargetScrollTop, baseValue, randomOffset);
412
366
  // 更新日期值
413
367
  if (updateDay) {
414
368
  // 解析文本中的数字(移除年、月、日等后缀)
@@ -497,26 +451,11 @@ function PickerGroupRegion(props) {
497
451
  const [targetScrollTop, setTargetScrollTop] = React.useState(0);
498
452
  const [currentIndex, setCurrentIndex] = React.useState(selectedIndex);
499
453
  const [isTouching, setIsTouching] = React.useState(false);
500
- const lengthScaleRatioRef = React.useRef(1);
501
454
  const itemHeightRef = React.useRef(PICKER_LINE_HEIGHT);
502
455
  const isUserBeginScrollRef = React.useRef(false);
503
- // 初始化时计算 lengthScaleRatio
504
- React.useEffect(() => {
505
- Taro.getSystemInfo({
506
- success: res => {
507
- lengthScaleRatioRef.current = calculateLengthScaleRatio(res);
508
- },
509
- fail: () => {
510
- // 失败时使用默认值 1
511
- lengthScaleRatioRef.current = 1;
512
- }
513
- });
514
- }, []);
515
456
  React.useEffect(() => {
516
457
  var _a;
517
- if (process.env.TARO_PLATFORM === 'harmony') {
518
- itemHeightRef.current = PICKER_LINE_HEIGHT * lengthScaleRatioRef.current;
519
- } else {
458
+ if (process.env.TARO_PLATFORM !== 'harmony') {
520
459
  if (scrollViewRef.current && ((_a = scrollViewRef.current) === null || _a === void 0 ? void 0 : _a.scrollHeight)) {
521
460
  itemHeightRef.current = scrollViewRef.current.scrollHeight / scrollViewRef.current.childNodes.length;
522
461
  } else {
@@ -551,7 +490,7 @@ function PickerGroupRegion(props) {
551
490
  setIsTouching(false);
552
491
  const baseValue = newIndex * itemHeightRef.current;
553
492
  const randomOffset = Math.random() * 0.001; // 随机数为了在一个项内滚动时强制刷新
554
- setTargetScrollTopWithScale(setTargetScrollTop, baseValue, randomOffset, lengthScaleRatioRef.current);
493
+ setTargetScrollTopWithScale(setTargetScrollTop, baseValue, randomOffset);
555
494
  updateIndex(newIndex, columnId, false, isUserBeginScrollRef.current);
556
495
  }, 100);
557
496
  };