Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
929799b
fix: 为兼容 cpp 版本做的暂时性的牺牲改动 (#3325)
xiaoyatong Aug 7, 2025
7ee836a
Merge branch 'feat_v3.x' into feat_v3.x_cpp
xiaoyatong Aug 15, 2025
94c5073
chore: 升级版本号
xiaoyatong Aug 20, 2025
5dfd20f
feat(popup): 增加上下滑动修改高度
xiaoyatong Aug 20, 2025
bd12ee6
feat: 合并popup功能
xiaoyatong Aug 21, 2025
e47d0d4
feat(popup): 添加自定义顶部
xiaoyatong Aug 21, 2025
e7a4b1f
fix(input): taro 下只读可以点击
xiaoyatong Aug 21, 2025
75057e6
feat(popup): 增加一些新属性,顺便解决了下input的只读无法点击、焦点等问题 (#3342)
xiaoyatong Aug 21, 2025
7da9642
chore: 升级版本号
xiaoyatong Aug 29, 2025
08e97b5
feat: 新样式变量值更新,修订dialog暗黑问题
xiaoyatong Sep 3, 2025
3da0ec6
chore: 修改版本号
xiaoyatong Sep 20, 2025
e90b2b2
feat(popup): 增加top属性,支持自定义节点,,且不popup高度
xiaoyatong Sep 20, 2025
3cbfe75
chore: 修改版本号
xiaoyatong Sep 20, 2025
88462db
feat: 合并3.x 分支
xiaoyatong Sep 29, 2025
8ce8c51
Feat v3 cpp td (#3364)
xiaoyatong Sep 29, 2025
68c851b
feat(dialog): 升级样式规范
xiaoyatong Oct 2, 2025
32b4cea
feat(dialog): 升级样式规范
xiaoyatong Oct 2, 2025
4e6df5d
feat: 修订button在安卓下的问题
xiaoyatong Oct 3, 2025
cf0553a
fix(noticebar): 获取rect异常时不处理
xiaoyatong Oct 4, 2025
1509b39
feat(noticebar): 增加自定义children时的样式,重构部分代码
xiaoyatong Oct 5, 2025
710afd9
feat(input): 去掉lineheight
xiaoyatong Oct 5, 2025
2be0323
feat(checkbox): 增加选中态自定义类名
xiaoyatong Oct 5, 2025
2379441
fix: dialog规范及toast ios和安卓适配问题修订
xiaoyatong Oct 9, 2025
e7f84cc
fix(dialog): 适配ios和安卓,动效暂时屏蔽
xiaoyatong Oct 10, 2025
7054cee
fix(noticebar): 增加ref id
xiaoyatong Oct 13, 2025
93c518f
feat(dialog): demo
xiaoyatong Oct 13, 2025
1b997a4
fix: 去掉不支持的样式
xiaoyatong Oct 13, 2025
23dba7a
fix: 回跨不兼容样式处理
xiaoyatong Oct 14, 2025
0354507
fix: 回跨不兼容样式处理,不能暴露~~
xiaoyatong Oct 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nutui/nutui-react-taro",
"version": "3.0.18",
"version": "3.0.19-cpp.10",
"style": "dist/style.css",
"main": "dist/nutui.react.umd.js",
"module": "dist/es/packages/nutui.react.build.js",
Expand Down Expand Up @@ -109,7 +109,7 @@
"dependencies": {
"@babel/runtime": "^7.23.9",
"@nutui/icons-react": "^3.0.2-beta.5",
"@nutui/icons-react-taro": "^3.0.2-beta.3",
"@nutui/icons-react-taro": "^3.0.2-cpp.2",
"@nutui/jdesign-icons-react-taro": "1.0.6-beta.2",
Comment on lines +112 to 113
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

pnpm 下 “resolutions” 不生效且版本不一致,建议改为 overrides 并对齐版本

  • 当前依赖为 @nutui/icons-react-taro: ^3.0.2-cpp.2,但 resolutions 中为 ^3.0.2-cpp.1;存在不一致,且在 pnpm 下 resolutions 通常不会生效,可能导致实际解析版本不可控。
  • 建议将 “resolutions” 更名为顶层 “overrides”(pnpm/npm 均支持),并将 @nutui/icons-react-taro 固定为 3.0.2-cpp.2 以与 dependencies 对齐。

建议修改如下:

-  "resolutions": {
+  "overrides": {
     "@types/react": "^18.2.57",
     "@types/react-dom": "^18.2.19",
     "sass": "1.77.6",
     "@tarojs/api": "4.0.12",
     "@tarojs/components": "4.0.12",
-    "@nutui/icons-react-taro": "^3.0.2-cpp.1"
+    "@nutui/icons-react-taro": "3.0.2-cpp.2"
   }

说明:

  • 若团队仍需兼容 Yarn,可保留 “resolutions”,但在 pnpm 场景下仍需 “overrides” 才能保证一致解析。

为确认当前仓库实际使用的包管理器与已解析版本,可运行:

Also applies to: 245-246, 239-246


🏁 Script executed:

#!/bin/bash
# 检查锁文件与包管理器线索
fd -a 'pnpm-lock.yaml' -H || true
fd -a 'yarn.lock' -H || true
jq -r '.packageManager // empty' package.json 2>/dev/null || true

# 检查 lock 中解析到的 @nutui/icons-react-taro 版本(pnpm 或 yarn)
rg -nC1 '@nutui/icons-react-taro' pnpm-lock.yaml yarn.lock 2>/dev/null || true

Length of output: 905


使用 overrides 替换 resolutions 并对齐 @nutui/icons-react-taro 版本

  • pnpm 不识别 package.json 中的 "resolutions",需改为顶层 "overrides"
  • 将 "@nutui/icons-react-taro" 固定为 "3.0.2-cpp.2" 以匹配 dependencies
-  "resolutions": {
+  "overrides": {
     "@types/react": "^18.2.57",
     "@types/react-dom": "^18.2.19",
     "sass": "1.77.6",
     "@tarojs/api": "4.0.12",
     "@tarojs/components": "4.0.12",
-    "@nutui/icons-react-taro": "^3.0.2-cpp.1"
+    "@nutui/icons-react-taro": "3.0.2-cpp.2"
   }
📝 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
"@nutui/icons-react-taro": "^3.0.2-cpp.2",
"@nutui/jdesign-icons-react-taro": "1.0.6-beta.2",
"overrides": {
"@types/react": "^18.2.57",
"@types/react-dom": "^18.2.19",
"sass": "1.77.6",
"@tarojs/api": "4.0.12",
"@tarojs/components": "4.0.12",
"@nutui/icons-react-taro": "3.0.2-cpp.2"
}
🤖 Prompt for AI Agents
In package.json around lines 112-113, replace any top-level "resolutions" entry
with a top-level "overrides" object and set "@nutui/icons-react-taro" to the
exact version "3.0.2-cpp.2" (remove the caret) so it matches the dependencies;
update the dependency entry to that exact version, add an "overrides": {
"@nutui/icons-react-taro": "3.0.2-cpp.2" } at the package.json root if not
present, remove the old "resolutions" block, and then run pnpm install to
regenerate the lockfile.

"@nutui/touch-emulator": "^1.0.0",
"@nutui/lottie-miniprogram": "^1.0.2",
Expand Down Expand Up @@ -241,6 +241,7 @@
"@types/react-dom": "^18.2.19",
"sass": "1.77.6",
"@tarojs/api": "4.0.12",
"@tarojs/components": "4.0.12"
"@tarojs/components": "4.0.12",
"@nutui/icons-react-taro": "^3.0.2-cpp.1"
}
}
14,997 changes: 7,870 additions & 7,127 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/hooks/taro/use-custom-event.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { useEffect, useRef } from 'react'
import isEqual from 'react-fast-compare'
import { Events, getCurrentInstance } from '@tarojs/taro'
import { eventCenter, getCurrentInstance } from '@tarojs/taro'
import { useForceUpdate } from '@/hooks/use-force-update'

export const customEvents = new Events()
// export const customEvents = new Events()
export const customEvents = eventCenter

export function useCustomEventsPath(selector?: string) {
selector = selector || ''
Expand Down
5 changes: 5 additions & 0 deletions src/packages/animatingnumbers/countup.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
.nut-countup {
&-list {
/* #ifndef dynamic*/
display: inline-flex;
/* #endif */
/* #ifdef dynamic*/
display: flex;
/* #endif */
height: $countup-height;
overflow: hidden;
direction: ltr;
Expand Down
8 changes: 3 additions & 5 deletions src/packages/avatarcropper/avatarcropper.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import React, {
useMemo,
useCallback,
FunctionComponent,
useLayoutEffect,
} from 'react'
import Taro, { createSelectorQuery } from '@tarojs/taro'
import Taro, { useReady, createSelectorQuery } from '@tarojs/taro'
import classNames from 'classnames'
import { Canvas, CommonEventFunction, View } from '@tarojs/components'
import { getWindowInfo } from '@/utils/taro/get-system-info'
Expand Down Expand Up @@ -138,7 +137,7 @@ export const AvatarCropper: FunctionComponent<
cropperCanvasContext: null,
})

useLayoutEffect(() => {
useReady(() => {
if (showAlipayCanvas2D) {
const { canvasId } = canvasAll
createSelectorQuery()
Expand All @@ -150,7 +149,7 @@ export const AvatarCropper: FunctionComponent<
})
.exec()
}
}, [showAlipayCanvas2D, state.displayHeight, state.displayWidth])
})

useEffect(() => {
setCanvasAll({
Expand Down Expand Up @@ -694,5 +693,4 @@ export const AvatarCropper: FunctionComponent<
</>
)
}

AvatarCropper.displayName = 'NutAvatarCropper'
10 changes: 10 additions & 0 deletions src/packages/badge/badge.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
.nut-badge {
position: relative;
/* #ifndef dynamic*/
display: inline-flex;
/* #endif */
/* #ifdef dynamic*/
display: flex;
/* #endif */
vertical-align: middle;
box-sizing: content-box;
width: auto;
Expand Down Expand Up @@ -38,7 +43,12 @@
}

&-sup {
/* #ifndef dynamic*/
display: inline-flex;
/* #endif */
/* #ifdef dynamic*/
display: flex;
/* #endif */
text-align: center;
min-width: $badge-min-width;
padding: $badge-padding;
Expand Down
3 changes: 3 additions & 0 deletions src/packages/button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
transform: translate(-50%, -50%);
opacity: 0;
content: ' ';
/* #ifdef dynamic*/
pointer-events: none;
/* #endif */
Comment on lines +58 to +60
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

功能修复合理,但请确认条件宏一致性(dynamic vs harmony dynamic)

此处给 ::before 加 pointer-events: none 能避免覆盖层拦截点击,方向正确。不过本文件前面使用的是 “/* #ifdef harmony dynamic*/”,这里写成了 “/* #ifdef dynamic*/”。若两者在构建预处理并非同义,可能导致某些端未生效,仍出现点击被遮挡的问题。建议统一为同一宏,或两者都兼容一遍以免漏网。

为便捷核查,可在仓库根目录运行下列脚本统计两种写法的分布,评估是否需要统一:


🏁 Script executed:

#!/bin/bash
# 检查 SCSS 中 dynamic 条件宏的用法是否一致
echo "Match: /* #ifdef dynamic*/"
rg -n -C1 -g '**/*.scss' $'/\\*\\s*#ifdef\\s+dynamic\\s*\\*/'

echo
echo "Match: /* #ifdef harmony dynamic*/"
rg -n -C1 -g '**/*.scss' $'/\\*\\s*#ifdef\\s+harmony\\s+dynamic\\s*\\*/'

echo
echo "本文件定位:"
rg -n -C2 -g 'src/packages/button/button.scss' $'/\\*\\s*#if(n)?def\\b[^*]*\\*/|pointer-events\\s*:\\s*none\\s*;'

Length of output: 8219


🏁 Script executed:

#!/bin/bash
echo "Context around ::before in src/packages/button/button.scss"
rg -n -C5 '::before' -g 'src/packages/button/button.scss'

echo
echo "Full file beginning (lines 1–200):"
sed -n '1,200p' src/packages/button/button.scss

Length of output: 6348


保持条件宏一致pointer-events 区块的宏由

/* #ifdef dynamic*/
pointer-events: none;
/* #endif */

改为

/* #ifdef harmony dynamic*/
pointer-events: none;
/* #endif */

确保与文件其他处使用的宏一致,否则该样式在部分构建条件下无法生效。

🤖 Prompt for AI Agents
In src/packages/button/button.scss around lines 58 to 60, the conditional macro
around the pointer-events block is inconsistent with the project's convention;
update the opening macro from "/* #ifdef dynamic*/" to "/* #ifdef harmony
dynamic*/" so the block matches other uses of the harmony macro and will be
included under the correct build conditions; keep the closing "/* #endif */"
as-is.

}

&::after {
Expand Down
37 changes: 20 additions & 17 deletions src/packages/button/button.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@ import React, { CSSProperties, useCallback, useMemo } from 'react'
import type { MouseEvent } from 'react'
import classNames from 'classnames'
import {
ButtonProps as MiniProgramButtonProps,
// ButtonProps as MiniProgramButtonProps,
View,
Button as TaroButton,
// Button as TaroButton,
} from '@tarojs/components'
import { Loading } from '@nutui/icons-react-taro'
import { getEnv } from '@tarojs/taro'
import { BasicComponent, ComponentDefaults } from '@/utils/typings'
import { harmony } from '@/utils/taro/platform'

type OmitMiniProgramButtonProps = Omit<
MiniProgramButtonProps,
'size' | 'type' | 'onClick' | 'style'
>
// type OmitMiniProgramButtonProps = Omit<
// MiniProgramButtonProps,
// 'size' | 'type' | 'onClick' | 'style'
// >

export type ButtonType =
| 'default'
Expand All @@ -27,9 +26,11 @@ export type ButtonSize = 'xlarge' | 'large' | 'normal' | 'small' | 'mini'
export type ButtonShape = 'square' | 'round'
export type ButtonFill = 'solid' | 'outline' | 'dashed' | 'none'

export interface ButtonProps
extends BasicComponent,
OmitMiniProgramButtonProps {
// export interface ButtonProps
// extends BasicComponent,
// OmitMiniProgramButtonProps {

export interface ButtonProps extends BasicComponent {
color: string
shape: ButtonShape
type: ButtonType
Expand Down Expand Up @@ -76,7 +77,7 @@ export const Button = React.forwardRef<HTMLButtonElement, Partial<ButtonProps>>(
children,
className,
style,
formType,
// formType,
nativeType,
onClick,
...rest
Expand Down Expand Up @@ -145,17 +146,18 @@ export const Button = React.forwardRef<HTMLButtonElement, Partial<ButtonProps>>(
className
)

if (getEnv() === 'WEB') {
;(rest as any).type = formType
}
// if (getEnv() === 'WEB') {
// ;(rest as any).type = formType
// }
return (
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line react/button-has-type
<TaroButton
// <TaroButton
<View
{...rest}
ref={ref}
formType={formType || nativeType}
// formType={formType || nativeType}
className={buttonClassNames}
style={{ ...getStyle, ...style }}
onClick={(e) => handleClick(e as any)}
Expand All @@ -175,7 +177,8 @@ export const Button = React.forwardRef<HTMLButtonElement, Partial<ButtonProps>>(
)}
{rightIcon}
</View>
</TaroButton>
</View>
// </TaroButton>
)
}
)
Expand Down
2 changes: 2 additions & 0 deletions src/packages/cascader/cascader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
}

.nut-tabs-titles-item {
/* #ifndef dynamic*/
flex: initial;
/* #endif */
min-width: auto;
width: auto;
padding: $cascader-tabs-item-padding;
Expand Down
5 changes: 5 additions & 0 deletions src/packages/checkbox/checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@

&-button {
position: relative;
/* #ifndef dynamic*/
display: inline-flex;
/* #endif */
/* #ifdef dynamic*/
display: flex;
/* #endif */
align-items: center;
min-height: 32px;
padding: $checkbox-button-padding;
Expand Down
1 change: 1 addition & 0 deletions src/packages/checkbox/checkbox.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ export const Checkbox: FC<
{
[`${classPrefix}-reverse`]: labelPosition === 'left',
'nut-checkbox-list-item': ctx?.list,
[`${classPrefix}-active`]: innerChecked,
},
className
)}
Expand Down
1 change: 1 addition & 0 deletions src/packages/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export const Checkbox: FunctionComponent<
{
[`${classPrefix}-reverse`]: labelPosition === 'left',
'nut-checkbox-list-item': ctx?.list,
[`${classPrefix}-active`]: innerChecked,
},
className
)}
Expand Down
5 changes: 5 additions & 0 deletions src/packages/checkboxgroup/checkboxgroup.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
flex-wrap: wrap;

.nut-checkbox {
/* #ifndef dynamic*/
display: inline-flex;
/* #endif */
/* #ifdef dynamic*/
display: flex;
/* #endif */
flex: 1;
margin-right: 20px;

Expand Down
4 changes: 4 additions & 0 deletions src/packages/configprovider/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ export type NutCSSVariables =
| 'nutuiFontSizeS'
| 'nutuiFontSizeBase'
| 'nutuiFontSizeL'
| 'nutuiFontSizeIcon'
| 'nutuiFontSizeXl'
| 'nutuiFontSizeXxl'
| 'nutuiFontSize10'
| 'nutuiFontSize11'
| 'nutuiFontWeightLight'
| 'nutuiFontWeight'
| 'nutuiFontWeightMedium'
| 'nutuiFontWeightBold'
| 'nutuiLineHeightBase'
| 'nutuiSpacingXxxs'
Expand Down Expand Up @@ -459,10 +461,12 @@ export type NutCSSVariables =
| 'nutuiDialogMinHeight'
| 'nutuiDialogBorderRadius'
| 'nutuiDialogBackground'
| 'nutuiDialogTitleMarginBottom'
| 'nutuiDialogContentMargin'
| 'nutuiDialogContentMaxHeight'
| 'nutuiDialogContentLineHeight'
| 'nutuiDialogContentTextAlign'
| 'nutuiDialogFooterButtonBorder'
| 'nutuiDialogFooterButtonMinWidth'
| 'nutuiDialogFooterCancelMarginRight'
| 'nutuiDialogFooterCancelBg'
Expand Down
4 changes: 4 additions & 0 deletions src/packages/dialog/demos/taro/demo6.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ const Demo6 = () => {
cancelText="决策2"
onConfirm={() => setVisible2(false)}
onCancel={() => setVisible2(false)}
onClose={() => {
setVisible2(false)
console.log('关闭底部icon 3')
}}
closeIcon
>
支持函数调用和组件调用两种方式。
Expand Down
10 changes: 8 additions & 2 deletions src/packages/dialog/dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
position: fixed;
max-height: 100%;
background-color: $dialog-background;
/* #ifndef dynamic*/
transition:
transform 0.2s,
-webkit-transform 0.2s;
/* #endif */
-webkit-overflow-scrolling: touch;
top: 50%;
left: 50%;
Expand Down Expand Up @@ -83,6 +85,7 @@
font-size: $dialog-header-font-size;
font-weight: $dialog-header-font-weight;
color: $color-title;
margin-bottom: $dialog-title-margin-bottom;
@include oneline-ellipsis();
}

Expand Down Expand Up @@ -125,22 +128,25 @@

.nut-button {
min-width: $dialog-footer-button-min-width;
border-radius: $dialog-footer-button-border;
padding: var(--nutui-button-large-padding, 0 12px);
}

&-cancel.nut-dialog-footer-cancel {
margin-right: $dialog-footer-cancel-margin-right;
background: $dialog-footer-cancel-bg;
color: $button-default-color;
border-color: var(--nutui-button-default-border-color, transparent);
.nut-button-children {
color: $button-default-color;
}
}

&-ok {
max-width: $dialog-footer-ok-max-width;
font-weight: $font-weight-bold;
font-weight: $font-weight-medium;
.nut-button-children {
font-weight: $font-weight-bold;
font-weight: $font-weight-medium;
}
}

Expand Down
Loading