-
Notifications
You must be signed in to change notification settings - Fork 4.9k
修复picker一些列问题,适配harmony侧,内置大屏放大计算,增加暗黑模式 #18654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Walkthrough本 PR 将大量 package.json 的版本从 4.1.8 更新为 4.1.9-beta.5;为 Picker 组件引入浅色/深色主题与颜色定制(代码 + 样式变量 + SCSS 主题块);在 picker-group 中添加缩放滚动与指示线颜色支持;为视频控制添加防守性判断;测试 setup 增加了 Taro API 的 jest mock。 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 分钟 需额外关注点:
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (5)
packages/taro-components-react/src/components/picker/index.tsx (1)
913-938: 内联样式条件应用方式可优化当前使用
{...(backgroundStyle ? { style: backgroundStyle } : {})}的扩展方式虽然功能正确,但可以简化为直接传递style属性。- <View className={clsSlider} {...(backgroundStyle ? { style: backgroundStyle } : {})}> - <View className="taro-picker__hd" {...(backgroundStyle ? { style: backgroundStyle } : {})}> + <View className={clsSlider} style={backgroundStyle || undefined}> + <View className="taro-picker__hd" style={backgroundStyle || undefined}>packages/taro-components-react/src/components/picker/style/index.scss (1)
124-135: 建议将遮罩渐变颜色参数化遮罩渐变中硬编码了
rgba(255, 255, 255, ...)和rgba(31, 31, 31, ...)。考虑将这些值提取为 SCSS 变量或函数,以便于维护和未来可能的主题扩展。在
variable.scss中添加渐变基础色变量:$weuiMaskGradientBaseLight: 255, 255, 255; $weuiMaskGradientBaseDark: 31, 31, 31;然后在主题块中使用:
.taro-picker__mask { background: linear-gradient( 180deg, rgba(#{$weuiMaskGradientBaseLight}, 0.95) 0%, // ... ); }Also applies to: 187-198
packages/taro-components-react/src/components/picker/picker-group.tsx (2)
44-60: 缩放比例计算逻辑需要文档说明
lengthScaleRatio的计算使用了多个魔法数字(320、400、600、720),这些阈值的含义和来源不明确,建议添加注释说明。+ // 320: 最小屏幕宽度基准 + // 400: 中等屏幕宽度基准 + // 600: 大屏判断阈值(平板等) + // 720: 大屏设计稿宽度基准 if (res.windowWidth < 320) { lengthScaleRatio = res.windowWidth / 320 } else if (res.windowWidth >= 400 && res.windowWidth < 600) { lengthScaleRatio = res.windowWidth / 400 } const shortSide = res.windowWidth < res.windowHeight ? res.windowWidth : res.windowHeight const isBigScreen = shortSide >= 600 if (isBigScreen) { lengthScaleRatio = shortSide / 720 }
94-101: 高度测量逻辑重复,建议提取为自定义 Hook四个 PickerGroup 组件中都有相同的高度测量
useEffect逻辑,建议提取为可复用的自定义 Hook。function useItemHeight( scrollViewRef: React.RefObject<TaroScrollView>, rangeLength: number ) { const itemHeightRef = React.useRef(PICKER_LINE_HEIGHT) React.useEffect(() => { if (process.env.TARO_PLATFORM !== 'harmony') { if (scrollViewRef.current?.scrollHeight) { itemHeightRef.current = scrollViewRef.current.scrollHeight / scrollViewRef.current.childNodes.length } else { console.warn('Picker: 高度测量异常,使用默认值') } } }, [rangeLength]) return itemHeightRef }Also applies to: 245-252, 398-405, 553-560
packages/taro-components-react/src/components/picker/style/variable.scss (1)
3-3: 主色调十六进制格式不一致
$weuiColorPrimary使用大写#FF0F23,而$weuiColorPrimaryDark使用小写#ff0f23。建议统一格式。-$weuiColorPrimaryDark: #ff0f23; +$weuiColorPrimaryDark: #FF0F23;Also applies to: 12-12
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (84)
crates/native_binding/package.json(1 hunks)npm/darwin-arm64/package.json(1 hunks)npm/darwin-x64/package.json(1 hunks)npm/linux-x64-gnu/package.json(1 hunks)npm/linux-x64-musl/package.json(1 hunks)npm/win32-x64-msvc/package.json(1 hunks)package.json(1 hunks)packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json(1 hunks)packages/babel-plugin-transform-solid-jsx/package.json(1 hunks)packages/babel-plugin-transform-taroapi/package.json(1 hunks)packages/babel-preset-taro/package.json(1 hunks)packages/create-app/package.json(1 hunks)packages/css-to-react-native/package.json(1 hunks)packages/eslint-config-taro/package.json(1 hunks)packages/eslint-plugin-taro/package.json(1 hunks)packages/jest-helper/package.json(1 hunks)packages/postcss-html-transform/package.json(1 hunks)packages/postcss-plugin-constparse/package.json(1 hunks)packages/postcss-pxtransform/package.json(1 hunks)packages/postcss-unit-transform/package.json(1 hunks)packages/rollup-plugin-copy/package.json(1 hunks)packages/shared/package.json(1 hunks)packages/stylelint-config-taro-rn/package.json(1 hunks)packages/stylelint-taro-rn/package.json(1 hunks)packages/stylelint-taro/package.json(1 hunks)packages/taro-api/package.json(1 hunks)packages/taro-cli-convertor/package.json(1 hunks)packages/taro-cli/package.json(1 hunks)packages/taro-components-advanced/package.json(1 hunks)packages/taro-components-library-react/package.json(1 hunks)packages/taro-components-library-solid/package.json(1 hunks)packages/taro-components-library-vue3/package.json(1 hunks)packages/taro-components-react/package.json(1 hunks)packages/taro-components-react/src/components/picker/index.tsx(7 hunks)packages/taro-components-react/src/components/picker/picker-group.tsx(22 hunks)packages/taro-components-react/src/components/picker/style/index.scss(5 hunks)packages/taro-components-react/src/components/picker/style/variable.scss(2 hunks)packages/taro-components-rn/package.json(1 hunks)packages/taro-components/package.json(1 hunks)packages/taro-components/src/components/video/video-control.tsx(3 hunks)packages/taro-extend/package.json(1 hunks)packages/taro-framework-react/package.json(1 hunks)packages/taro-framework-solid/package.json(1 hunks)packages/taro-framework-vue3/package.json(1 hunks)packages/taro-h5/package.json(1 hunks)packages/taro-helper/package.json(1 hunks)packages/taro-loader/package.json(1 hunks)packages/taro-platform-alipay/package.json(1 hunks)packages/taro-platform-ascf/package.json(1 hunks)packages/taro-platform-h5/package.json(1 hunks)packages/taro-platform-harmony-cpp/package.json(1 hunks)packages/taro-platform-harmony-hybrid/package.json(1 hunks)packages/taro-platform-harmony/package.json(1 hunks)packages/taro-platform-jd/package.json(1 hunks)packages/taro-platform-qq/package.json(1 hunks)packages/taro-platform-swan/package.json(1 hunks)packages/taro-platform-tt/package.json(1 hunks)packages/taro-platform-weapp/package.json(1 hunks)packages/taro-plugin-generator/package.json(1 hunks)packages/taro-plugin-html/package.json(1 hunks)packages/taro-plugin-http/package.json(1 hunks)packages/taro-plugin-inject/package.json(1 hunks)packages/taro-plugin-mini-ci/package.json(1 hunks)packages/taro-plugin-react-devtools/package.json(1 hunks)packages/taro-plugin-vue-devtools/package.json(1 hunks)packages/taro-react/package.json(1 hunks)packages/taro-rn-runner/package.json(1 hunks)packages/taro-rn-style-transformer/package.json(1 hunks)packages/taro-rn-supporter/package.json(1 hunks)packages/taro-rn-transformer/package.json(1 hunks)packages/taro-rn/package.json(1 hunks)packages/taro-router-rn/package.json(1 hunks)packages/taro-router/package.json(1 hunks)packages/taro-runner-utils/package.json(1 hunks)packages/taro-runtime-rn/package.json(1 hunks)packages/taro-runtime/package.json(1 hunks)packages/taro-service/package.json(1 hunks)packages/taro-transformer-wx/package.json(1 hunks)packages/taro-vite-runner/package.json(1 hunks)packages/taro-webpack5-prebundle/package.json(1 hunks)packages/taro-webpack5-runner/package.json(1 hunks)packages/taro-with-weapp/package.json(1 hunks)packages/taro/package.json(1 hunks)packages/taroize/package.json(1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2025-08-25T22:16:50.118Z
Learnt from: ianzone
Repo: NervJS/taro PR: 18150
File: packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json:2356-2356
Timestamp: 2025-08-25T22:16:50.118Z
Learning: The file `packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json` is auto-generated by the post-build script `packages/taro-platform-h5/scripts/post-build.mjs`, which copies content from `taro-platform-h5/dist/definition.json`. This file should not be manually edited.
Applied to files:
packages/postcss-unit-transform/package.jsonpackages/taro-platform-harmony/package.jsonpackages/taro-platform-jd/package.jsonpackages/taro-platform-ascf/package.jsonpackages/taro-h5/package.jsonpackages/babel-plugin-transform-taroapi/package.jsonpackages/taro-with-weapp/package.jsonpackages/taro-rn-transformer/package.jsonpackages/taro-runtime-rn/package.jsonpackages/taro-loader/package.jsonpackages/taro-platform-alipay/package.jsonpackages/taro-framework-react/package.jsonpackages/eslint-plugin-taro/package.jsonpackages/taro-platform-harmony-cpp/package.jsonpackages/taro-plugin-generator/package.jsonpackages/taro-components-react/package.jsonpackages/taro-cli-convertor/package.jsonpackages/taro-runner-utils/package.jsonpackages/taro-vite-runner/package.jsonpackages/taro-framework-vue3/package.jsonpackages/taro-components-library-react/package.jsonpackages/eslint-config-taro/package.jsonpackages/taro-components-library-solid/package.jsonpackages/taro-plugin-react-devtools/package.jsonpackages/taro-plugin-html/package.jsonpackages/taro-components-library-vue3/package.jsonpackages/taro-components-advanced/package.jsonpackages/taro-platform-h5/package.jsonpackages/taro-webpack5-runner/package.jsonpackages/babel-preset-taro/package.jsonpackages/taro-platform-tt/package.jsonpackages/taro-platform-harmony-hybrid/package.jsonpackages/stylelint-taro-rn/package.jsonpackages/taro-plugin-http/package.jsonpackages/taro-transformer-wx/package.jsonpackages/taro-components/package.jsonpackages/taro-plugin-mini-ci/package.jsonpackages/taro-webpack5-prebundle/package.jsonpackages/taro-api/package.jsonpackages/taro-platform-qq/package.jsonpackages/babel-plugin-transform-solid-jsx/package.jsonpackages/taro-plugin-inject/package.jsonpackages/taro-framework-solid/package.jsonpackages/taroize/package.jsonpackages/taro-rn-style-transformer/package.jsonpackages/taro/package.jsonpackages/taro-plugin-vue-devtools/package.jsonpackages/taro-extend/package.jsonpackages/taro-react/package.jsonpackages/taro-service/package.jsonpackages/taro-platform-weapp/package.jsonpackages/shared/package.jsonpackages/taro-helper/package.jsonpackages/taro-rn/package.jsonpackages/stylelint-config-taro-rn/package.jsonpackages/taro-rn-runner/package.jsonpackages/taro-components-rn/package.jsonpackages/taro-runtime/package.jsonpackages/taro-platform-swan/package.jsonpackages/jest-helper/package.jsonpackages/stylelint-taro/package.jsonpackages/taro-cli/package.json
📚 Learning: 2025-09-05T18:40:45.775Z
Learnt from: ianzone
Repo: NervJS/taro PR: 18150
File: packages/taro-platform-harmony-hybrid/package.json:43-45
Timestamp: 2025-09-05T18:40:45.775Z
Learning: 在 tarojs/plugin-platform-harmony-hybrid 包中,tarojs/components-library-react、tarojs/components-library-solid 和 tarojs/components-library-vue3 必须作为直接依赖(dependencies)而不能作为 peer 依赖,因为插件源码中有对这些包的直接引用,包括 componentAdapter* getter 方法和 webpack 别名配置。
Applied to files:
packages/taro-platform-harmony/package.jsonpackages/taro-platform-jd/package.jsonpackages/taro-platform-alipay/package.jsonpackages/taro-framework-react/package.jsonpackages/taro-platform-harmony-cpp/package.jsonpackages/taro-components-react/package.jsonpackages/taro-framework-vue3/package.jsonpackages/taro-components-library-react/package.jsonpackages/taro-components-library-solid/package.jsonpackages/taro-plugin-react-devtools/package.jsonpackages/taro-plugin-html/package.jsonpackages/taro-components-library-vue3/package.jsonpackages/taro-components-advanced/package.jsonpackages/taro-platform-h5/package.jsonpackages/taro-platform-tt/package.jsonpackages/taro-platform-harmony-hybrid/package.jsonpackages/taro-plugin-http/package.jsonpackages/taro-components/package.jsonpackages/taro-platform-qq/package.jsonpackages/taro-plugin-inject/package.jsonpackages/taro-framework-solid/package.jsonpackages/taro-plugin-vue-devtools/package.jsonpackages/taro-react/package.jsonpackages/taro-platform-weapp/package.jsonpackages/taro-components-rn/package.jsonpackages/taro-platform-swan/package.json
📚 Learning: 2025-05-25T18:02:31.387Z
Learnt from: ianzone
Repo: NervJS/taro PR: 17746
File: packages/taro-runtime/tsdown.config.ts:10-16
Timestamp: 2025-05-25T18:02:31.387Z
Learning: 在 taro-runtime 包的 tsdown 配置中,必须禁用 treeshake 来保留 dom-external/index.js 文件。
Applied to files:
packages/taro-h5/package.jsonpackages/taro-runtime-rn/package.jsonpackages/taro-components-react/package.jsonpackages/taro-components-library-solid/package.jsonpackages/taro-components/package.jsonpackage.jsonpackages/taro-react/package.jsonpackages/shared/package.jsonpackages/taro-rn/package.jsonnpm/darwin-x64/package.jsonpackages/taro-components-react/src/components/picker/picker-group.tsxpackages/taro-runtime/package.jsonpackages/jest-helper/package.json
📚 Learning: 2025-11-21T07:15:22.634Z
Learnt from: ianzone
Repo: NervJS/taro PR: 18646
File: packages/taro/package.json:40-40
Timestamp: 2025-11-21T07:15:22.634Z
Learning: 在 tarojs/taro 包中添加 vite 作为 devDependency 是为了让 tarojs/vite-runner 能够依赖正确的 vite 类型版本,确保 monorepo 中的类型兼容性。
Applied to files:
packages/taro-h5/package.jsonpackages/taro-with-weapp/package.jsonpackages/taro-runtime-rn/package.jsonpackages/taro-loader/package.jsonpackages/taro-runner-utils/package.jsonpackages/taro-vite-runner/package.jsonpackages/taro-framework-vue3/package.jsonpackages/taro-plugin-react-devtools/package.jsonpackages/taro-components-library-vue3/package.jsonpackages/taro-webpack5-runner/package.jsonpackages/taro-components/package.jsonpackages/taro-webpack5-prebundle/package.jsonpackage.jsonpackages/taroize/package.jsonpackages/taro/package.jsonpackages/taro-plugin-vue-devtools/package.jsonpackages/shared/package.jsonpackages/taro-helper/package.jsonpackages/taro-rn/package.jsonpackages/taro-rn-runner/package.jsonpackages/taro-runtime/package.jsonpackages/jest-helper/package.json
📚 Learning: 2025-08-08T02:32:58.265Z
Learnt from: ianzone
Repo: NervJS/taro PR: 18146
File: packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json:12-14
Timestamp: 2025-08-08T02:32:58.265Z
Learning: 在 Taro 项目的 pnpm 工作区中,Vitest 相关依赖(vitest 和 vitest/coverage-istanbul)被管理在根目录的 package.json 中,而不是各个子包的 devDependencies 中。这是 monorepo 中依赖提升的标准做法。
Applied to files:
packages/taro-vite-runner/package.jsonpackages/taro-components/package.jsonpackages/jest-helper/package.json
📚 Learning: 2025-06-23T00:09:31.233Z
Learnt from: ianzone
Repo: NervJS/taro PR: 17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
Applied to files:
packages/jest-helper/package.json
🪛 GitHub Actions: Node CI
packages/taro-components-react/src/components/picker/picker-group.tsx
[error] 44-44: TypeError: Taro.getSystemInfo is not a function. The tests rely on a mocked Taro API; ensure getSystemInfo is available or properly mocked in the test environment.
🔇 Additional comments (84)
packages/taro-transformer-wx/package.json (1)
3-3: 版本号更新合理。版本统一更新至4.1.9-beta.5,符合PR范围内的协调版本发布流程。
packages/taro-router-rn/package.json (1)
3-3: 版本号更新合理。与其他包的版本更新保持同步。
packages/taro-webpack5-prebundle/package.json (1)
3-3: 版本号更新合理。与PR整体版本发布流程一致。
packages/babel-plugin-transform-taroapi/package.json (1)
3-3: 版本号更新合理。packages/taro-framework-vue3/package.json (1)
3-3: 版本号更新合理。packages/postcss-unit-transform/package.json (1)
3-3: 版本号更新合理。packages/taro-loader/package.json (1)
3-3: 版本号更新合理。npm/linux-x64-gnu/package.json (1)
4-4: 版本号更新合理。Native binding包版本也同步更新至4.1.9-beta.5。
packages/taro-cli/package.json (1)
3-3: 版本号更新一致性检查通过版本号从 4.1.8 更新至 4.1.9-beta.5,与 PR 范围内其他 package.json 文件保持一致。无依赖项、脚本或导出 API 变化。
packages/postcss-pxtransform/package.json (1)
3-3: 单一合并审查:所有 package.json 版本号更新所提供的 8 个 package.json 文件(taro-cli、eslint-config-taro、taro-plugin-inject、postcss-html-transform、taro-extend、taroize、taro-platform-tt、postcss-pxtransform)的版本号都已一致更新至 4.1.9-beta.5。此变更符合 PR 描述中的单一版本同步计划(涵盖 60+ package 文件)。
验证项:
- ✅ 所有版本号从 4.1.8 → 4.1.9-beta.5,完全一致
- ✅ 无依赖项或 peerDependencies 调整
- ✅ 无脚本变化
- ✅ 无公共 API 变更
- ✅ 符合语义化版本规范(beta 版本)
此类跨 monorepo 的协调版本更新是标准做法,无问题发现。
packages/taro-h5/package.json (1)
3-3: 版本号更新一致,无其他改动。将版本从 4.1.8 升级至 4.1.9-beta.5 作为 beta 版本发布的一部分,符合 PR 目标。
packages/taro-platform-qq/package.json (1)
3-3: 版本号更新一致。将版本从 4.1.8 升级至 4.1.9-beta.5,与其他包的更新保持一致。
packages/taro-platform-jd/package.json (1)
3-3: 版本号更新一致。将版本从 4.1.8 升级至 4.1.9-beta.5,与 PR 中其他包的更新保持同步。
packages/jest-helper/package.json (1)
3-3: 版本号更新一致。作为 monorepo 内部工具包,版本号从 4.1.8 升级至 4.1.9-beta.5,与整体发布计划同步。
package.json (1)
3-3: 根项目版本号更新一致。将 monorepo 根项目版本从 4.1.8 升级至 4.1.9-beta.5,与子包版本保持同步。
packages/taro-runner-utils/package.json (1)
3-3: 版本号更新一致。将版本从 4.1.8 升级至 4.1.9-beta.5,与 PR 中的其他包保持一致。
packages/taro-components-rn/package.json (1)
3-3: 版本号更新一致。将 React Native 组件包版本从 4.1.8 升级至 4.1.9-beta.5,依赖结构保持不变。
packages/babel-plugin-transform-solid-jsx/package.json (1)
4-4: 版本号更新一致。将 Babel 插件版本从 4.1.8 升级至 4.1.9-beta.5,与整体 monorepo 发布计划同步。
packages/shared/package.json (1)
3-3: 版本号更新符合规范,无其他改动。版本号从 4.1.8 更新为 4.1.9-beta.5,符合 SemVer 规范中的预发布版本格式。该变更仅涉及元数据,未改动任何功能或依赖项。
packages/taro-components-advanced/package.json (1)
3-3: 版本号更新一致,无其他改动。版本号从 4.1.8 更新为 4.1.9-beta.5,与 PR 中其他包的版本更新保持一致,符合预发布版本规范。
packages/create-app/package.json (1)
3-3: 版本更新正确。版本号从 4.1.8 更新为 4.1.9-beta.5,无其他变更。
packages/taro-platform-harmony-hybrid/package.json (1)
3-3: 版本更新符合预期。版本号从 4.1.8 更新为 4.1.9-beta.5,与本 PR 鸿蒙平台适配的目标保持一致,无其他改动。
packages/taro-components/package.json (1)
3-3: 版本号更新正确且一致。版本号从 4.1.8 更新为 4.1.9-beta.5,核心组件库的脚本、依赖项和构建配置均保持不变。
packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json (1)
3-3: 版本更新一致。版本号从 4.1.8 更新为 4.1.9-beta.5,无其他改动。
packages/taro-api/package.json (1)
3-3: 版本号更新正确。版本号从 4.1.8 更新为 4.1.9-beta.5,API 接口和依赖项均未改动。
packages/taro-plugin-html/package.json (1)
3-3: 版本更新符合规范。版本号从 4.1.8 更新为 4.1.9-beta.5,无其他改动。
packages/taro-rn/package.json (1)
3-3: 版本号更新与其他包保持一致。该版本更新符合本 PR 的版本统一更新目标(4.1.8 → 4.1.9-beta.5)。无其他字段修改,无风险。
packages/taro-cli-convertor/package.json (1)
3-3: 版本号更新一致。版本从 4.1.8 更新至 4.1.9-beta.5,与其他包保持同步。
packages/taro-framework-react/package.json (1)
3-3: 版本号更新合理。版本字段更新至 4.1.9-beta.5,与整个 monorepo 的版本策略一致。
packages/taro-platform-weapp/package.json (1)
3-3: 版本号更新正常。版本从 4.1.8 → 4.1.9-beta.5,维持 monorepo 版本一致性。
packages/taro-platform-swan/package.json (1)
3-3: 版本号更新与其他包同步。版本更新为 4.1.9-beta.5,保持 monorepo 版本一致。
packages/postcss-plugin-constparse/package.json (1)
3-3: 版本号更新一致。版本从 4.1.8 更新至 4.1.9-beta.5,与其他 package 保持同步。
packages/taro-with-weapp/package.json (1)
3-3: 版本号更新合理。版本字段更新至 4.1.9-beta.5,与 monorepo 版本策略一致。
packages/css-to-react-native/package.json (1)
4-4: 版本号更新正常。版本从 4.1.8 → 4.1.9-beta.5,与整个 monorepo 的版本统一更新保持一致。
packages/stylelint-taro/package.json (1)
3-3: 版本号更新一致。版本从 4.1.8 更新至 4.1.9-beta.5,与整个 monorepo 的版本更新策略保持一致,无其他改动。
packages/taro-rn-supporter/package.json (1)
3-3: 版本号更新一致。版本从 4.1.8 更新至 4.1.9-beta.5,与整个 monorepo 的版本更新策略保持一致,所有依赖版本号未变更。
packages/taro-helper/package.json (1)
3-3: 版本号更新一致。版本从 4.1.8 更新至 4.1.9-beta.5,与整个 monorepo 的版本更新策略保持一致,所有依赖版本号和配置未变更。
packages/taro-plugin-vue-devtools/package.json (1)
3-3: 版本号更新一致。版本从 4.1.8 更新至 4.1.9-beta.5,与整个 monorepo 的版本更新策略保持一致,无其他改动。
packages/babel-preset-taro/package.json (1)
3-3: 版本号更新一致。版本从 4.1.8 更新至 4.1.9-beta.5,与整个 monorepo 的版本更新策略保持一致,所有依赖版本号和配置保持不变。
packages/taro-runtime/package.json (1)
3-3: 版本号更新一致。版本从 4.1.8 更新至 4.1.9-beta.5,与整个 monorepo 的版本更新策略保持一致,所有依赖版本号和关键配置(如 sideEffects)保持不变。
packages/taro-components-library-react/package.json (1)
3-3: 版本号更新一致。版本从 4.1.8 更新至 4.1.9-beta.5,与整个 monorepo 的版本更新策略保持一致,无其他改动。
packages/taro-service/package.json (1)
3-3: 版本号更新一致。版本从 4.1.8 更新至 4.1.9-beta.5,与整个 monorepo 的版本更新策略保持一致,所有依赖版本号和配置保持不变。
packages/taro-runtime-rn/package.json (1)
3-3: 版本号更新无问题。版本从 4.1.8 更新至 4.1.9-beta.5,格式正确,且与其他包保持一致。
packages/taro-platform-alipay/package.json (1)
3-3: 版本号更新无问题。版本从 4.1.8 更新至 4.1.9-beta.5,与其他包版本保持一致。
packages/taro-rn-transformer/package.json (1)
3-3: 版本号更新无问题。版本从 4.1.8 更新至 4.1.9-beta.5,保持版本一致性。
npm/darwin-arm64/package.json (1)
4-4: 版本号更新无问题。版本从 4.1.8 更新至 4.1.9-beta.5,平台配置保持不变。
packages/stylelint-config-taro-rn/package.json (1)
3-3: 版本号更新无问题。版本从 4.1.8 更新至 4.1.9-beta.5,与其他包版本保持一致。
packages/taro-plugin-react-devtools/package.json (1)
3-3: 版本号更新无问题。版本从 4.1.8 更新至 4.1.9-beta.5,保持版本一致性。
packages/taro-platform-ascf/package.json (1)
3-3: 版本号更新无问题。版本从 4.1.8 更新至 4.1.9-beta.5,版本号保持一致。
packages/taro/package.json (1)
3-3: 版本号更新无问题。版本从 4.1.8 更新至 4.1.9-beta.5,主包版本更新正确。workspace:* 依赖引用已保持不变,版本一致性良好。
crates/native_binding/package.json (1)
1-3: 版本号更新一致。版本号从 4.1.8 升级至 4.1.9-beta.5,符合单库统一版本管理的做法。
packages/taro-plugin-http/package.json (1)
1-3: 版本号更新无误。版本号从 4.1.8 升级至 4.1.9-beta.5,与单库版本管理策略一致,依赖配置保持不变。
packages/taro-react/package.json (1)
1-3: 版本号更新正确。版本号升级至 4.1.9-beta.5,与单库版本控制方案保持同步,workspace 工作区依赖无需修改。
packages/taro-router/package.json (1)
1-3: 版本号更新符合规范。版本号升级至 4.1.9-beta.5,内部工作区依赖和外部依赖均正确处理。
packages/taro-plugin-mini-ci/package.json (1)
1-3: 版本号升级正确。版本号从 4.1.8 更新至 4.1.9-beta.5,各类依赖配置保持稳定,符合预发布版本的管理规范。
packages/rollup-plugin-copy/package.json (1)
1-3: 版本号更新无问题。版本号升级至 4.1.9-beta.5,私有包的版本号和依赖配置均正确保持。
packages/taro-components-library-vue3/package.json (1)
1-3: 版本号更新一致。版本号升级至 4.1.9-beta.5,工作区依赖和开发依赖配置无需调整。
packages/taro-components-library-solid/package.json (1)
1-3: 版本号升级正确。版本号统一升级至 4.1.9-beta.5,依赖关系配置保持不变,符合单库版本控制规范。
packages/stylelint-taro-rn/package.json (1)
3-3: 版本号更新一致。 元数据变更,与 PR 范围内其他 package.json 的版本升级保持一致。packages/eslint-plugin-taro/package.json (1)
3-3: 版本号更新一致。 元数据变更,与 PR 范围内其他包的版本升级保持一致。packages/taro-plugin-generator/package.json (1)
3-3: 版本号更新一致。 元数据变更,与 PR 范围内其他包的版本升级保持一致。packages/taro-rn-runner/package.json (1)
3-3: 版本号更新一致。 元数据变更,与 PR 范围内其他包的版本升级保持一致。packages/taro-webpack5-runner/package.json (1)
3-3: 版本号更新一致。 元数据变更,与 PR 范围内其他包的版本升级保持一致。packages/taro-platform-h5/package.json (1)
3-3: 版本号更新一致。 元数据变更,与 PR 范围内其他包的版本升级保持一致。packages/taro-vite-runner/package.json (1)
3-3: 版本号更新一致。 元数据变更,与 PR 范围内其他包的版本升级保持一致。npm/win32-x64-msvc/package.json (1)
4-4: 版本号更新一致。 元数据变更,与 PR 范围内其他 npm 平台绑定包的版本升级保持一致。npm/darwin-x64/package.json (1)
4-4: 版本号更新对齐合理仅更新
version至4.1.9-beta.5,与其它 binding 包统一版本,无功能行为变化。npm/linux-x64-musl/package.json (1)
3-3: Linux musl binding 版本号同步此处仅同步
@tarojs/binding-linux-x64-musl的version为4.1.9-beta.5,属于发布版本对齐,不影响运行时逻辑。packages/taro-framework-solid/package.json (1)
3-3: Solid 框架插件版本提升无额外影响
@tarojs/plugin-framework-solid仅调整version至4.1.9-beta.5,未改依赖与构建脚本,作为发布号更新是安全的。packages/taro-rn-style-transformer/package.json (1)
3-3: RN 样式转换器版本号对齐
@tarojs/rn-style-transformer仅做版本号从 4.1.8 →4.1.9-beta.5的同步,脚本与依赖保持不变,可直接合入。packages/taro-platform-harmony/package.json (1)
3-3: Harmony ETS 插件版本同步
@tarojs/plugin-platform-harmony-ets版本号更新为4.1.9-beta.5,与仓库整体版本线保持一致,未引入行为变更。packages/taro-platform-harmony-cpp/package.json (1)
3-3: Harmony C-API 插件版本更新正确
@tarojs/plugin-platform-harmony-cpp仅更新version至4.1.9-beta.5,不影响 C-API 逻辑及依赖配置。packages/taro-components/src/components/video/video-control.tsx (2)
65-68: 禁用 controls 时的早退与隐藏处理逻辑清晰在
toggleVisibility中对!this.controls直接复位visible并返回,同时在render里对!controls提前返回一个display: 'none'的 Host,可以确保禁用控制条时不再触发显示/隐藏逻辑,也不会渲染进度与按钮区域,避免不必要的事件处理与潜在异常,这一调整是合理的。Also applies to: 127-133
91-92: 为currentTimeRef增加空引用保护是必要的
setCurrentTime在写入innerHTML前先判断this.currentTimeRef是否存在,可避免组件初始化早期或showProgress为 false 时出现空引用运行时错误,改动安全且有助于提升鲁棒性。packages/taro-components-react/package.json (1)
3-3: React 组件包版本号同步到 Picker 新特性版本
@tarojs/components-react仅更新version至4.1.9-beta.5,用于对齐包含 Picker 主题与暗黑模式能力的新版本,实现与实际代码变更的发布号一致性,无额外风险。packages/taro-components-react/src/components/picker/index.tsx (3)
114-117: 新增颜色配置属性,接口设计合理新增的
backgroundColor、lineColor和titleColor属性扩展了主题定制能力,与现有的按钮颜色配置保持一致的设计风格。
148-148: 主题模式属性设计良好
theme属性支持'light' | 'dark'两种模式,默认值为'light',符合常见的主题设计模式。
886-890: 主题类名和样式应用逻辑正确通过
taro-picker-theme-${theme}动态类名实现主题切换,结合backgroundStyle和titleStyle的条件内联样式,提供了灵活的定制能力。packages/taro-components-react/src/components/picker/style/index.scss (2)
87-148: 浅色主题样式实现完整浅色主题包含了遮罩、头部、操作按钮、标题、内容区、指示器和选项状态的完整样式定义,使用 SCSS 变量确保可维护性。
150-211: 深色主题样式与浅色主题结构一致深色主题复用了相同的样式结构,使用对应的 Dark 变量,确保两个主题的一致性和完整性。
packages/taro-components-react/src/components/picker/picker-group.tsx (2)
31-36: 指示器样式函数实现简洁
getIndicatorStyle函数正确地返回了边框颜色样式对象,用于自定义指示器线条颜色。
202-205: 指示器样式条件应用方式正确通过条件展开
{...(indicatorStyle ? { style: indicatorStyle } : {})}确保只在有自定义颜色时才应用样式,避免覆盖主题默认样式。Also applies to: 357-360, 512-515, 658-661
packages/taro-components-react/src/components/picker/style/variable.scss (2)
1-17: 主题颜色变量定义完整且命名规范浅色和深色主题的颜色变量组织清晰,命名遵循统一的规范(Light/Dark 后缀),便于维护和扩展。
19-28: 层级和尺寸变量设计合理z-index 层级设计合理(container < mask < indicator),尺寸变量提供了集中管理的便利。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/taro-components-react/__tests__/setup.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-08-25T22:16:50.118Z
Learnt from: ianzone
Repo: NervJS/taro PR: 18150
File: packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json:2356-2356
Timestamp: 2025-08-25T22:16:50.118Z
Learning: The file `packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json` is auto-generated by the post-build script `packages/taro-platform-h5/scripts/post-build.mjs`, which copies content from `taro-platform-h5/dist/definition.json`. This file should not be manually edited.
Applied to files:
packages/taro-components-react/__tests__/setup.ts
📚 Learning: 2025-05-25T18:02:31.387Z
Learnt from: ianzone
Repo: NervJS/taro PR: 17746
File: packages/taro-runtime/tsdown.config.ts:10-16
Timestamp: 2025-05-25T18:02:31.387Z
Learning: 在 taro-runtime 包的 tsdown 配置中,必须禁用 treeshake 来保留 dom-external/index.js 文件。
Applied to files:
packages/taro-components-react/__tests__/setup.ts
📚 Learning: 2025-11-21T07:15:22.634Z
Learnt from: ianzone
Repo: NervJS/taro PR: 18646
File: packages/taro/package.json:40-40
Timestamp: 2025-11-21T07:15:22.634Z
Learning: 在 tarojs/taro 包中添加 vite 作为 devDependency 是为了让 tarojs/vite-runner 能够依赖正确的 vite 类型版本,确保 monorepo 中的类型兼容性。
Applied to files:
packages/taro-components-react/__tests__/setup.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
- GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
- GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
- GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-gnu
- GitHub Check: Build Rust WASM / stable - wasm32-wasi
| // Mock Taro API | ||
| const mockGetSystemInfo = jest.fn(({ success, fail } = { success: undefined, fail: undefined }) => { | ||
| try { | ||
| success?.({ | ||
| windowWidth: 375, | ||
| windowHeight: 667, | ||
| pixelRatio: 2, | ||
| lengthScaleRatio: 1 | ||
| }) | ||
| } catch (error) { | ||
| fail?.(error) | ||
| } | ||
| }) | ||
|
|
||
| jest.mock('@tarojs/taro', () => { | ||
| return { | ||
| __esModule: true, | ||
| default: { | ||
| getSystemInfo: mockGetSystemInfo, | ||
| }, | ||
| getSystemInfo: mockGetSystemInfo, | ||
| } | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for getSystemInfo usage patterns in taro-components-react package
echo "=== getSystemInfo usage in taro-components-react ==="
rg -n "getSystemInfo" packages/taro-components-react -C3
echo ""
echo "=== Other @tarojs/taro imports/usage in taro-components-react ==="
rg -n "@tarojs/taro|from.*taro" packages/taro-components-react --type ts --type tsx -C1Repository: NervJS/taro
Length of output: 2054
🏁 Script executed:
#!/bin/bash
# Search for other @tarojs/taro imports in source files
echo "=== @tarojs/taro imports in src ==="
rg -n "from.*@tarojs/taro|import.*@tarojs/taro" packages/taro-components-react/src -C1
echo ""
echo "=== @tarojs/taro imports in tests ==="
rg -n "from.*@tarojs/taro|import.*@tarojs/taro" packages/taro-components-react/__tests__ -C1
echo ""
echo "=== All Taro.* API calls in src ==="
rg -n "Taro\." packages/taro-components-react/src -C1Repository: NervJS/taro
Length of output: 2153
🏁 Script executed:
#!/bin/bash
# Check what test files exist and what they import
echo "=== Test files in __tests__ ==="
find packages/taro-components-react/__tests__ -name "*.ts" -o -name "*.tsx" | head -20
echo ""
echo "=== Content of setup.ts (full file) ==="
cat packages/taro-components-react/__tests__/setup.ts
echo ""
echo "=== Check if pull-down-refresh has tests ==="
find packages/taro-components-react/__tests__ -name "*pull*" -o -name "*refresh*"Repository: NervJS/taro
Length of output: 15338
Verify the test impact and fix necessity with eventCenter mock
Based on verification, the review comment is partially correct but misfocused:
✅ Real issue: The jest.mock completely replaces @tarojs/taro and omits Taro.eventCenter, which is used in pull-down-refresh/index.tsx (lines 130, 137). Currently low-impact because pull-down-refresh has no tests, but it's a latent risk.
❌ Not an issue: mockGetSystemInfo only supports callback style, but code only uses callbacks (picker-group.tsx line 44). No Promise-style usage exists, so the defensive Promise wrapping suggestion is unnecessary.
The review should prioritize the incomplete mock risk over the hypothetical Promise concern. The suggested jest.requireActual approach is sound and recommended.
Taro.getSystemInfo mock 应确保完整 mock @tarojs/taro 模块中的其他 API
好主意把 Picker 依赖的系统信息提出来做全局 mock。但有一个需要尽早规避的潜在风险:
当前 jest.mock 只提供了 getSystemInfo,遗漏了其他 Taro API:
pull-down-refresh/index.tsx中使用了Taro.eventCenter.on()和Taro.eventCenter.off()(第 130、137 行)- 虽然目前 pull-down-refresh 还没有对应的测试用例,但如果后续添加测试,这些 API 会是
undefined,导致测试失败 - 建议使用
jest.requireActual做部分 mock,将真实模块的内容透传,只覆盖需要 mock 的getSystemInfo:
jest.mock('@tarojs/taro', () => {
+ const actual = jest.requireActual('@tarojs/taro')
return {
__esModule: true,
+ ...actual,
- default: {
+ default: {
+ ...actual.default,
getSystemInfo: mockGetSystemInfo,
},
getSystemInfo: mockGetSystemInfo,
}
})这样既能保证 Picker 的系统信息 mock 生效,又不会破坏其他组件对 Taro API 的依赖。
🤖 Prompt for AI Agents
In packages/taro-components-react/__tests__/setup.ts around lines 10–32, the
current jest.mock fully replaces @tarojs/taro and only provides getSystemInfo,
which omits other runtime APIs like Taro.eventCenter used in pull-down-refresh
(lines 130,137) and creates a latent test break; update the mock to import the
real module via jest.requireActual and merge it with an override for
getSystemInfo (and ensure both the default export and named export are
preserved), or explicitly forward eventCenter (on/off) from the real module so
other components keep working while getSystemInfo remains mocked.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #18654 +/- ##
=======================================
Coverage 56.33% 56.33%
=======================================
Files 447 447
Lines 23342 23342
Branches 5763 5751 -12
=======================================
Hits 13149 13149
- Misses 8364 8365 +1
+ Partials 1829 1828 -1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
这个 PR 做了什么? (简要描述所做更改)
1.修复Picker滚动位置异常问题
2.Picker适配harmony侧
3.picker内置计算大屏缩放比例作为兜底
4.picker增加暗黑模式,增加部分颜色参数暴露
5.修复picker判断异常问题
6.修复video控制异常问题
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台:
Summary by CodeRabbit
发布说明
新功能
Bug 修复
测试
杂项
✏️ Tip: You can customize this high-level summary in your review settings.