Skip to content
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

Feat/range 适配 JDRN、鸿蒙端 #2357

Merged
merged 18 commits into from
Jun 20, 2024
Merged

Conversation

lyxuncle
Copy link

@lyxuncle lyxuncle commented Jun 14, 2024

🤔 这个变动的性质是?

  • 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

💡 需求背景和解决方案

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • fork仓库代码是否为最新避免文件冲突
  • Files changed 没有 package.json lock 等无关文件

Summary by CodeRabbit

  • 新特性

    • 为应用添加Range组件的支持。
    • 组件版本更新至3.0.0。
  • 样式

    • 基于平台检测的Cell组件样式调整,使用pxTransform()进行动态样式设置。
    • 更新了各个示例组件的样式结构,改用<View>标签进行渲染,并添加了适用于不同平台的样式条件。
  • 代码优化

    • 使用useMemo优化样式计算,提升性能。
    • 注释掉Toast组件的相关代码。
  • 修复

    • 修复了getXgetY函数,以更准确地返回touch对象的属性。

Copy link

coderabbitai bot commented Jun 14, 2024

Walkthrough

这些改动主要发生在 packages/nutui-taro-demo-rnsrc 目录下,包含了对多个文件的功能优化和代码调整,特别是对导出实体的修改、版本号更新,以及重构触摸事件处理、样式适配等。其中显著的一点是注释掉了对 Toast 组件的使用,并对样式做了基于平台的调整,以更好地支持跨平台运行。

Changes

文件路径 修改摘要
.../scripts/taro/adapted.js 添加了 'range' 到导出列表
.../src/app.config.ts 移除了 defineAppConfig 函数名后的空格
src/config.json 更新了 "Range" 组件的版本号从 "2.0.0""3.0.0"
.../utils/use-touch.ts 修改 getXgetY 函数,使用空值合并运算符 (??) 代替逻辑 OR 操作符 (`
.../range/demos/taro/demo1.tsx 调整了样式逻辑;优化了导入;注释了 Toast 组件
.../range/demos/taro/demo2.tsx/demo3.tsx/demo4.tsx/demo5.tsx/demo6.tsx/demo7.tsx/demo8.tsx/demo9.tsx/demo10.tsx/demo11.tsx/demo12.tsx/demo13.tsx cellStyle 做了基于平台的调整,使用 useMemopxTransform 调整样式;注释 Toast 组件;更新了组件结构

Poem

兔儿轻跳,

代码变美妙。

样式新调整,

平台皆跑跑。

触摸逻辑巧,

Toast 暂且消。

版本号攀高,

🐰软件卓超超!


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b9cdbe8 and 94d516c.

Files selected for processing (17)
  • packages/nutui-taro-demo-rn/scripts/taro/adapted.js (1 hunks)
  • packages/nutui-taro-demo-rn/src/app.config.ts (1 hunks)
  • src/config.json (1 hunks)
  • src/packages/range/demos/taro/demo1.tsx (2 hunks)
  • src/packages/range/demos/taro/demo10.tsx (1 hunks)
  • src/packages/range/demos/taro/demo11.tsx (1 hunks)
  • src/packages/range/demos/taro/demo12.tsx (2 hunks)
  • src/packages/range/demos/taro/demo13.tsx (3 hunks)
  • src/packages/range/demos/taro/demo2.tsx (1 hunks)
  • src/packages/range/demos/taro/demo3.tsx (2 hunks)
  • src/packages/range/demos/taro/demo4.tsx (1 hunks)
  • src/packages/range/demos/taro/demo5.tsx (2 hunks)
  • src/packages/range/demos/taro/demo6.tsx (1 hunks)
  • src/packages/range/demos/taro/demo7.tsx (2 hunks)
  • src/packages/range/demos/taro/demo8.tsx (1 hunks)
  • src/packages/range/demos/taro/demo9.tsx (1 hunks)
  • src/utils/use-touch.ts (2 hunks)
Files skipped from review as they are similar to previous changes (15)
  • packages/nutui-taro-demo-rn/src/app.config.ts
  • src/config.json
  • src/packages/range/demos/taro/demo1.tsx
  • src/packages/range/demos/taro/demo10.tsx
  • src/packages/range/demos/taro/demo11.tsx
  • src/packages/range/demos/taro/demo12.tsx
  • src/packages/range/demos/taro/demo13.tsx
  • src/packages/range/demos/taro/demo2.tsx
  • src/packages/range/demos/taro/demo4.tsx
  • src/packages/range/demos/taro/demo5.tsx
  • src/packages/range/demos/taro/demo6.tsx
  • src/packages/range/demos/taro/demo7.tsx
  • src/packages/range/demos/taro/demo8.tsx
  • src/packages/range/demos/taro/demo9.tsx
  • src/utils/use-touch.ts
Additional context used
Biome
packages/nutui-taro-demo-rn/scripts/taro/adapted.js

[error] 1-1: A global variable should not be reassigned. (lint/suspicious/noGlobalAssign)

Assigning to a global variable can override essential functionality.

Additional comments not posted (1)
src/packages/range/demos/taro/demo3.tsx (1)

1-5: 更新了导入和条件样式,以支持不同平台的特定功能。这些更改与 PR 的目标一致,以适应 JDRN 和鸿蒙端。

Also applies to: 8-19


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 20

Outside diff range and nitpick comments (5)
src/packages/range/demos/taro/demo12.tsx (1)

7-22: 根据平台动态调整样式,使用了 rn() 来适配 JDRN 平台。建议在文档中添加对这些特定平台样式调整的说明,以便其他开发者理解和维护。

src/packages/range/demos/taro/demo11.tsx (2)

7-27: 根据平台动态调整样式,使用了 rn() 来适配 JDRN 平台。建议在文档中添加对这些特定平台样式调整的说明,以便其他开发者理解和维护。


29-36: 使用 harmony() 来适配鸿蒙平台,确保样式的一致性和兼容性。这种平台特定的代码分支处理是必要的,但也增加了代码的复杂性。

src/packages/range/demos/taro/demo13.tsx (1)

7-45: 针对 JDRN 和鸿蒙平台进行了样式调整。这种平台特定的代码分支处理是必要的,但也增加了代码的复杂性。建议在文档中添加对这些特定平台样式调整的说明,以便其他开发者理解和维护。

src/packages/range/demo.taro.tsx (1)

15-15: 注释了 Demo10 的引用。如果这个组件是永久移除的,建议从项目中完全删除相关的文件和资源,以避免未来的混淆和潜在错误。

src/packages/range/demos/taro/demo9.tsx Outdated Show resolved Hide resolved
src/packages/range/demos/taro/demo2.tsx Outdated Show resolved Hide resolved
src/packages/range/demos/taro/demo6.tsx Outdated Show resolved Hide resolved
src/packages/range/demos/taro/demo4.tsx Show resolved Hide resolved
src/packages/range/demos/taro/demo4.tsx Outdated Show resolved Hide resolved
src/utils/use-touch.ts Outdated Show resolved Hide resolved
src/utils/use-touch.ts Outdated Show resolved Hide resolved
src/packages/range/range.harmony.css Show resolved Hide resolved
src/packages/range/range.harmony.css Outdated Show resolved Hide resolved
src/packages/range/range.scss Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

Outside diff range and nitpick comments (1)
packages/nutui-taro-demo-rn/scripts/taro/adapted.js (1)

Line range hint 1-1: 请避免重新分配全局变量,这可能会覆盖重要功能。

- exports = module.exports = [
+ module.exports = [

Comment on lines +56 to +64
const isSameValue = (newValue: RangeValue, oldValue: RangeValue) => {
return JSON.stringify(newValue) === JSON.stringify(oldValue)
}

const handleOverlap = (value: number[]) => {
if (value[0] > value[1]) {
return value.slice(0).reverse()
}
return value
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isSameValue 函数通过比较 JSON 字符串来检查两个值是否相同,这种方法虽然简单,但可能会因为 JSON.stringify 的顺序问题而导致意外的结果。建议改用更稳定的深度比较方法。

- return JSON.stringify(newValue) === JSON.stringify(oldValue)
+ return _.isEqual(newValue, oldValue) // 使用 lodash 的 isEqual 方法进行深度比较
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const isSameValue = (newValue: RangeValue, oldValue: RangeValue) => {
return JSON.stringify(newValue) === JSON.stringify(oldValue)
}
const handleOverlap = (value: number[]) => {
if (value[0] > value[1]) {
return value.slice(0).reverse()
}
return value
const isSameValue = (newValue: RangeValue, oldValue: RangeValue) => {
return _.isEqual(newValue, oldValue) // 使用 lodash 的 isEqual 方法进行深度比较
}
const handleOverlap = (value: number[]) => {
if (value[0] > value[1]) {
return value.slice(0).reverse()
}
return value

Comment on lines +306 to +380
const onTouchStart = useCallback(
(event: any) => {
if (disabled) {
return
}
touch.start(event)
setExactValue(current)
if (isRange(current)) {
setStartValue((current as number[]).map(format))
} else {
updateValue([left, value], true)
setStartValue(format(current as number))
}
} else {
updateValue(value, true)
}
}

const onTouchStart = (event: any) => {
setDragStatus('start')
},
[current, disabled, format, isRange, touch]
)

const onTouchMove = useCallback(
async (event: any) => {
// @TODO RN、鸿蒙端垂直滑动时,页面会一同滑动,待解决
if (disabled || !root.current) {
return
}
if (dragStatus === 'start') {
onStart && onStart()
}

touch.move(isRn ? event.nativeEvent : event)
// console.log(JSON.stringify(event.touches[0]))

setDragStatus('draging')

const rect = await getRectByTaro(root.current)
if (!rect) return
let delta = isHm
? parseFloat(pxTransform(touch.deltaX.current))
: touch.deltaX.current
let total = rect.width
// console.log(pxTransform(delta), total)
let diff = (delta / total) * scope
diff = rtl ? -diff : diff
if (vertical) {
delta = isHm
? parseFloat(pxTransform(touch.deltaY.current))
: touch.deltaY.current
total = rect.height
diff = (delta / total) * scope
}

let newValue
if (isRange(startValue)) {
newValue = (exactValue as number[]).slice()
newValue[buttonIndex] = startValue[buttonIndex] + diff
} else {
newValue = startValue + diff
}
setExactValue(newValue)
updateValue(newValue)
},
[
buttonIndex,
disabled,
dragStatus,
exactValue,
isRange,
onStart,
rtl,
scope,
startValue,
touch,
updateValue,
vertical,
]
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onTouchMove 函数处理触摸移动事件。代码中有一处待解决的 TODO 注释,关于在 RN 和 鸿蒙端垂直滑动时页面会一同滑动的问题,建议跟踪这个问题,确保它能够得到妥善解决。

- // @TODO RN、鸿蒙端垂直滑动时,页面会一同滑动,待解决
+ // @TODO 解决 RN 和 鸿蒙端在垂直滑动时页面同步滑动的问题
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const onTouchStart = useCallback(
(event: any) => {
if (disabled) {
return
}
touch.start(event)
setExactValue(current)
if (isRange(current)) {
setStartValue((current as number[]).map(format))
} else {
updateValue([left, value], true)
setStartValue(format(current as number))
}
} else {
updateValue(value, true)
}
}
const onTouchStart = (event: any) => {
setDragStatus('start')
},
[current, disabled, format, isRange, touch]
)
const onTouchMove = useCallback(
async (event: any) => {
// @TODO RN、鸿蒙端垂直滑动时,页面会一同滑动,待解决
if (disabled || !root.current) {
return
}
if (dragStatus === 'start') {
onStart && onStart()
}
touch.move(isRn ? event.nativeEvent : event)
// console.log(JSON.stringify(event.touches[0]))
setDragStatus('draging')
const rect = await getRectByTaro(root.current)
if (!rect) return
let delta = isHm
? parseFloat(pxTransform(touch.deltaX.current))
: touch.deltaX.current
let total = rect.width
// console.log(pxTransform(delta), total)
let diff = (delta / total) * scope
diff = rtl ? -diff : diff
if (vertical) {
delta = isHm
? parseFloat(pxTransform(touch.deltaY.current))
: touch.deltaY.current
total = rect.height
diff = (delta / total) * scope
}
let newValue
if (isRange(startValue)) {
newValue = (exactValue as number[]).slice()
newValue[buttonIndex] = startValue[buttonIndex] + diff
} else {
newValue = startValue + diff
}
setExactValue(newValue)
updateValue(newValue)
},
[
buttonIndex,
disabled,
dragStatus,
exactValue,
isRange,
onStart,
rtl,
scope,
startValue,
touch,
updateValue,
vertical,
]
)
const onTouchMove = useCallback(
async (event: any) => {
// @TODO 解决 RN 和 鸿蒙端在垂直滑动时页面同步滑动的问题
if (disabled || !root.current) {
return
}
if (dragStatus === 'start') {
onStart && onStart()
}
touch.move(isRn ? event.nativeEvent : event)
// console.log(JSON.stringify(event.touches[0]))
setDragStatus('draging')
const rect = await getRectByTaro(root.current)
if (!rect) return
let delta = isHm
? parseFloat(pxTransform(touch.deltaX.current))
: touch.deltaX.current
let total = rect.width
// console.log(pxTransform(delta), total)
let diff = (delta / total) * scope
diff = rtl ? -diff : diff
if (vertical) {
delta = isHm
? parseFloat(pxTransform(touch.deltaY.current))
: touch.deltaY.current
total = rect.height
diff = (delta / total) * scope
}
let newValue
if (isRange(startValue)) {
newValue = (exactValue as number[]).slice()
newValue[buttonIndex] = startValue[buttonIndex] + diff
} else {
newValue = startValue + diff
}
setExactValue(newValue)
updateValue(newValue)
},
[
buttonIndex,
disabled,
dragStatus,
exactValue,
isRange,
onStart,
rtl,
scope,
startValue,
touch,
updateValue,
vertical,
]
)
Tools
Biome

[error] 334-334: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.

import { Range, Cell, Toast } from '@nutui/nutui-react-taro'
import React, { useMemo, useState } from 'react'
import { View } from '@tarojs/components'
import { Range, Cell /* , Toast */ } from '@nutui/nutui-react-taro'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

移除了 Toast 组件的引用,但在项目的其他部分仍然有大量的 Toast 组件使用实例。因此,移除 Toast 组件的引用可能会导致功能问题。

  • src/packages/table/demo.taro.tsx
  • src/packages/table/demos/h5/demo9.tsx
  • src/packages/hoverbutton/demos/h5/demo1.tsx
  • src/packages/hoverbutton/demos/h5/demo2.tsx
  • src/packages/toast/Notification.tsx
  • src/packages/toast/demo.taro.tsx
  • src/packages/toast/toast.taro.tsx
  • src/packages/toast/index.taro.ts
  • src/packages/toast/toast.tsx
  • src/packages/toast/__test__/toast.spec.tsx
  • src/packages/toast/demos/taro/demo5.tsx
  • src/packages/toast/demos/taro/demo4.tsx
  • src/packages/toast/demos/taro/demo3.tsx
  • src/packages/toast/demos/taro/demo1.tsx
  • src/packages/toast/demos/h5/demo5.tsx
  • src/packages/toast/demos/h5/demo3.tsx
  • src/packages/toast/demos/h5/demo2.tsx
  • src/packages/toast/demos/h5/demo1.tsx
  • src/packages/toast/demos/h5/demo4.tsx
Analysis chain

移除了 Toast 组件的引用,但在项目的其他部分仍然有大量的 Toast 组件使用实例。因此,移除 Toast 组件的引用可能会导致功能问题。

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the Toast component is not used elsewhere in the project where it might still be necessary.

# Test: Search for the Toast usage in the project. Expect: No critical usage that conflicts with its removal.
rg --type typescript $'Toast' --files-with-matches

Length of output: 84



Script:

#!/bin/bash
# Description: Verify that the Toast component is not used elsewhere in the project where it might still be necessary.

# Test: Search for the Toast usage in the project. Expect: No critical usage that conflicts with its removal.
rg --type ts 'Toast'

Length of output: 41463

Comment on lines +46 to +53
{/* <Toast
type="text"
visible={show}
content={msg}
onClose={() => {
setShow(false)
}}
/>
</>
/> */}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释了 Toast 组件的使用,如果这是临时的,请添加 TODO 或 FIXME 标记。

+ // TODO: Review the necessity of Toast component here and decide whether to reintroduce or permanently remove.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{/* <Toast
type="text"
visible={show}
content={msg}
onClose={() => {
setShow(false)
}}
/>
</>
/> */}
// TODO: Review the necessity of Toast component here and decide whether to reintroduce or permanently remove.
{/* <Toast
type="text"
visible={show}
content={msg}
onClose={() => {
setShow(false)
}}
/> */}

Comment on lines +483 to +503
key={index}
className={classNames(`${classPrefix}-button-wrapper-${suffix}`, {
[`${verticalClassPrefix}-button-wrapper-${suffix}`]: vertical,
[`${rtlClassPrefix}-button-wrapper-${suffix}`]: rtl,
})}
style={{
transform,
}}
onTouchStart={(e) => {
if (typeof index === 'number') {
// 实时更新当前拖动的按钮索引
setButtonIndex(index)
}
onTouchStart(e)
}}
onTouchMove={(e) => onTouchMove(e)}
onTouchEnd={onTouchEnd}
onTouchCancel={onTouchEnd}
onClick={(e) => e.stopPropagation()}
>
{renderButton(index)}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

触发鼠标事件的操作还应该伴有相应的键盘事件以支持仅使用键盘的导航。

+ onKeyUp={(e) => { /* handle key up */ }}

Also applies to: 510-524, 554-562

Tools
Biome

[error] 483-503: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

const [buttonIndex, setButtonIndex] = useState(0)
const [dragStatus, setDragStatus] = useState('start' || 'draging' || '')
const touch = useTouch()
const root = useRef<HTMLDivElement>(null)
const [marksList, setMarksList] = useState<number[]>([])

const [startValue, setStartValue] = useState<any>(0)
const scope = useMemo(() => max - min, [max, min])

const handleChange = (value: RangeValue) => {
onChange && onChange(value)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议使用可选链来简化代码。

- onChange && onChange(value)
+ onChange?.(value)

Also applies to: 317-318

Tools
Biome

[error] 105-105: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.

Comment on lines +51 to +53
const isSameValue = (newValue: RangeValue, oldValue: RangeValue) => {
return JSON.stringify(newValue) === JSON.stringify(oldValue)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isSameValue 函数通过比较 JSON 字符串来判断值是否相同,这种方法虽然简单,但可能会有性能问题,特别是当值包含大量数据或复杂结构时。建议使用更高效的深度比较方法。

- return JSON.stringify(newValue) === JSON.stringify(oldValue)
+ return _.isEqual(newValue, oldValue)  // 使用 lodash 的 isEqual 进行深度比较
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const isSameValue = (newValue: RangeValue, oldValue: RangeValue) => {
return JSON.stringify(newValue) === JSON.stringify(oldValue)
}
const isSameValue = (newValue: RangeValue, oldValue: RangeValue) => {
return _.isEqual(newValue, oldValue) // 使用 lodash 的 isEqual 进行深度比较
}

Copy link
Collaborator

@xiaoyatong xiaoyatong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Demo 最好要兼容老的实现,兼容 小程序 和 h5 的最简写法~~

Copy link
Collaborator

@xiaoyatong xiaoyatong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要fix 冲突

@@ -26,15 +34,15 @@ const Demo1 = () => {
onEnd={(val) => showToast(`${val}`)}
/>
</Cell>
<Toast
{/* <Toast
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要影响 h5 和 小程序~

padding: '40px 18px',
}
const cellStyle = useMemo(
() => ({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最好保持 h5 和 小程序 的最简写法~ 做兼容处理。
以下的demo类似~~

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

@@ -26,6 +26,7 @@ exports = module.exports = [
'hoverbutton',
'safearea',
'hoverbuttonitem',
'range',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

添加 'range' 到导出列表是符合 PR 目标的。但是,请注意修复全局变量重新赋值的问题。

- exports = module.exports = [
+ module.exports = [
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'range',
module.exports = [
'range',

Comment on lines +37 to +44
{/* <Toast
type="text"
visible={show}
content={msg}
onClose={() => {
setShow(false)
}}
/>
</>
/> */}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释了 'Toast' 组件的使用。建议添加 TODO 或 FIXME 标记,以便将来审查此组件的必要性和是否重新引入或永久移除。

+ // TODO: Review the necessity of Toast component here and decide whether to reintroduce or permanently remove.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{/* <Toast
type="text"
visible={show}
content={msg}
onClose={() => {
setShow(false)
}}
/>
</>
/> */}
{/* <Toast
type="text"
visible={show}
content={msg}
onClose={() => {
setShow(false)
}}
/> */}
// TODO: Review the necessity of Toast component here and decide whether to reintroduce or permanently remove.

@xiaoyatong xiaoyatong merged commit 8fc0ef5 into jdf2e:dev-harmony Jun 20, 2024
@coderabbitai coderabbitai bot mentioned this pull request Nov 11, 2024
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants