已开启
refactor: migration GitHub code #7
refactor: migration GitHub code #7
已开启
suilyy创建于 7月18日
suilyy
suilyy
7月18日

refactor: migration GitHub code

likedislike
合并受阻
suilyysuilyy
7月18日 关联了issue:refactor: migration GitHub code
openharmony_ci
openharmony_ci成员
7月18日 评论:

感谢提交 Pull Requests!
Thanks for submitting a pull request.

likedislike
openharmony_ciopenharmony_ci成员
7月18日 添加了label:dco检查成功
cpf-manager
cpf-manager7月18日进行代码检视1
src/helpers.js
@@ -34,8 +34,10 @@ export function transformStyleProps(styleProps, neomorph) {
3434 width,
3535 height,
3636 borderRadius = 0,
37- backgroundColor,
38- shadowOpacity = neomorph ? 0 : 1,
37+ fill,
38+ fillOpacity = neomorph ? 0 : 1,
39+ stopColor,//渐变结束的颜色
40+ startColor,//渐变开始的颜色
3941 shadowOffset = { width: 0, height: 0 },
4042 shadowRadius,
4143 shadowColor,
@@ -122,9 +124,11 @@ export function transformStyleProps(styleProps, neomorph) {
122124 width,
123125 height,
cpf-manager
cpf-manager7月18日评论:

【AI-Review】【致命】【基础代码问题】【代码逻辑错误】helpers.js返回字段重命名导致Neomorph组件运行时崩溃

● 问题: helpers.jstransformStyleProps函数将allShadowProps中的backgroundColor重命名为fillshadowOpacity重命名为fillOpacity,但调用方Neomorph.js(本PR未修改)仍然解构backgroundColorshadowOpacity。触发路径:Neomorph.render()transformStyleProps(style, true) → 返回的allShadowPropsbackgroundColorundefined → 进入else分支调用brightness(backgroundColor)brightness(undefined)内部执行color.match(/^rgb/) → 抛出TypeError: Cannot read property 'match' of undefined,导致Neomorph组件崩溃。同样受影响的还有InnerShadow.js(解构backgroundColor用于容器背景)和OuterShadow.js

● 影响: 致命。所有使用Neomorph、InnerShadow、OuterShadow组件的场景均会崩溃或渲染异常,库的核心功能完全不可用。

● 建议: 要么同步修改所有调用方(Neomorph.js、InnerShadow.js、OuterShadow.js)以适配新的字段名,要么在helpers.js中同时保留backgroundColorfillshadowOpacityfillOpacity两个字段名以保持向后兼容。

likedislike
cpf-manager
cpf-manager7月18日进行代码检视1
src/InnerShadowART.js
@@ -42,3 +45,1 @@
42- <Surface height={height} width={width} style={{ position: 'absolute' }}>
43- <Group x={-stroke / 2 - 1} y={-stroke / 2 - 1}>
44- <Shape
45+ <Svg height={height} width={width} style={{ position: 'absolute' }}>
cpf-manager
cpf-manager7月18日评论:

【AI-Review】【严重】【基础代码问题】【代码逻辑错误】RadialGradient的id冲突导致多实例渐变失效

● 问题: InnerShadowART.jsOuterShadowART.js中的RadialGradient均使用硬编码的id="grad"。触发路径:Neomorph.render()renderOuter() → 同时渲染两个OuterShadowART实例(dark和light) → 两个SVG中各有一个id="grad"的渐变定义 → SVG渲染器根据DOM中id查找url(#grad)时只匹配第一个定义 → 两个shadow的fill="url(#grad)"都引用同一个渐变 → dark shadow和light shadow使用相同的渐变色,neumorphism的明暗对比效果丢失。同理,inner模式下两个InnerShadowART实例也会冲突。

● 影响: 严重。Neomorph组件的两个阴影(dark和light)会显示相同的渐变色,neumorphism核心视觉效果完全失效。

● 建议: 使用动态生成的唯一id替代硬编码的"grad",例如基于组件实例或使用React.useId()(React 18+)生成唯一id:const gradId = \grad-${Math.random().toString(36).slice(2)}`;,然后在fill={url(#${gradId})}`中使用。

likedislike
cpf-manager
cpf-manager7月18日进行代码检视1
src/InnerShadowART.js
@@ -45,1 +52,4 @@
52+ <G x={-stroke / 2 - 1} y={-stroke / 2 - 1}>
53+ <Path
4554 d={path}
55+ fill="url(#grad)"
cpf-manager
cpf-manager7月18日评论:

【AI-Review】【严重】【基础代码问题】【代码逻辑错误】InnerShadowART中backgroundColor未定义导致stroke始终为白色

● 问题: InnerShadowART.js的render方法解构props时移除了backgroundColor(替换为fillstopColorstartColorcolor),但在JSX中仍使用stroke={backgroundColor || 'white'}。触发路径:InnerShadowART.render() → 解构props中没有backgroundColorbackgroundColorundefinedstroke始终回退为'white' → 内阴影的描边颜色无法自定义,在深色背景下会出现白色边框。

● 影响: 严重。InnerShadow组件的描边颜色被固定为白色,无法根据组件背景色自适应,在深色背景场景下会出现明显的白色边框视觉缺陷。

● 建议: 将stroke={backgroundColor || 'white'}改为stroke={fill || 'white'},与新的props命名保持一致。

likedislike
cpf-manager
cpf-manager7月18日进行代码检视1
src/types.js
@@ -1,9 +1,9 @@
11import { ViewPropTypes } from 'react-native';
2-import { number, shape, string, node, bool } from 'prop-types';
2+import PropTypes,{ number, shape, string, node, bool } from 'prop-types';
33 
44export const ShadowARTType = {
55 width: number.isRequired,
@@ -16,10 +16,10 @@ export const ShadowARTType = {
1616};
1717 
1818export const InnerShadowType = {
cpf-manager
cpf-manager7月18日评论:

【AI-Review】【严重】【基础代码问题】【代码逻辑错误】PropTypes错误替换ViewPropTypes

● 问题: types.jsViewPropTypes(来自react-native)替换为PropTypes(来自prop-types),存在两个错误:1)...PropTypes将prop-types模块的所有方法(string、number、func、array、object等)作为prop定义展开,这些不是合法的prop名称;2)PropTypes.style在prop-types包中不存在,其值为undefined,导致NeomorphFlexType.styleShadowFlexType.styleundefined。触发路径:用户使用NeomorphFlexShadowFlex组件 → React检查propTypes进行类型校验 → style: undefined不提供任何类型检查 → 错误的style值不会被捕获。

● 影响: 严重。NeomorphFlex和ShadowFlex的style prop失去类型校验能力;InnerShadowType包含了大量无关的prop定义(string、number、func等),可能掩盖真正的prop类型错误。

● 建议: 不要使用PropTypes替换ViewPropTypesViewPropTypes在React Native 0.63+已被移除,正确的做法是:1)对于style prop使用PropTypes.object或自定义validator;2)对于view props使用手动列举需要的props(如accessible、accessibilityLabel等);3)或迁移到TypeScript类型定义替代PropTypes运行时检查。

likedislike
cpf-manager
cpf-manager7月18日进行代码检视1
package.json
@@ -3,10 +2,10 @@
3- "version": "1.1.2",
2+ "name": "@react-native-oh-tpl/react-native-neomorph-shadows",
3+ "version": "1.1.2-0.0.3",
44 "description": "Shadows and neumorphism/neomorphism UI for iOS & Android (like iOS).",
55 "main": "index.js",
66 "scripts": {
@@ -7,5 +7,5 @@
77 "test": "echo \"Error: no test specified\" && exit 1"
88 },
99 "dependencies": {
1010 "@react-native-community/art": "^1.2.0",
cpf-manager
cpf-manager7月18日评论:

【AI-Review】【严重】【业务功能】【功能实现错误】缺少react-native-svg依赖

● 问题: InnerShadowART.jsOuterShadowART.jsreact-native-svg导入了Svg, Path, G, RadialGradient, Defs, Stop组件,但package.jsondependencies中仍为@react-native-community/art: "^1.2.0",未添加react-native-svg作为依赖。触发路径:用户安装@react-native-oh-tpl/react-native-neomorph-shadows → npm不自动安装react-native-svg → 运行时import Svg, ... from 'react-native-svg' → 抛出Error: Cannot find module 'react-native-svg' → 应用崩溃。

● 影响: 严重。安装该库后应用直接崩溃,无法启动。这是所有使用该库的场景的必现问题。

● 建议: 在package.jsondependencies中添加"react-native-svg": "^15.0.0"(或适合的版本),同时移除不再使用的"@react-native-community/art"依赖。

likedislike
cpf-manager
cpf-manager7月18日进行代码检视1
src/helpers.js
@@ -126,2 +127,2 @@
126- backgroundColor === 'transparent' ? '#00000000' : backgroundColor,
127- shadowOpacity,
127+ fill:
128+ fill === 'transparent' ? '#00000000' : fill,
cpf-manager
cpf-manager7月18日评论:

【AI-Review】【一般】【基础代码问题】【代码逻辑错误】stopColor/startColor始终为undefined导致渐变不渲染

● 问题: InnerShadowART.jsOuterShadowART.js在SVG中使用<Stop stopColor={startColor}><Stop stopColor={stopColor}>渲染渐变,但所有调用方(Neomorph.js、InnerShadow.js、OuterShadow.js)的style中从未设置stopColor/startColor属性。虽然helpers.jstransformStyleProps会透传这两个属性到allShadowProps,但输入的styleProps中没有这些字段,解构后为undefined。触发路径:用户使用Neomorph/Shadow组件 → style中无stopColor/startColor → transformStyleProps透传undefinedInnerShadowART/OuterShadowART渲染<Stop stopColor={undefined}> → SVG渐变无法正确渲染,shadow区域可能显示为空白或黑色。

● 影响: 一般。当stopColor/startColor为undefined时,SVG渐变渲染行为不确定(取决于react-native-svg的实现),可能导致阴影区域渲染为空白或默认颜色,影响视觉效果。

● 建议: 在transformStyleProps中为stopColorstartColor提供合理的默认值,例如基于shadowColorbackgroundColor/fill计算;或者在调用方(Neomorph.js等)的styleDark/styleLight中明确设置这两个值。

likedislike
suilyy
suilyy
7月18日 评论:

start build

likedislike
openharmony_ci
openharmony_ci成员
7月18日 评论:

首次触发
门禁构建开始,包含静态检查、代码编译【rntpc_component编译】,预计在60分钟内完成,门禁结果会同步发送到注册邮箱。您可以通过如下链接跟踪门禁进展:http://dcp.openharmony.cn/workbench/cicd/detail/6a5b352a64650f998b6163de/runlist

likedislike
openharmony_ciopenharmony_ci成员
7月18日 添加了label:静态检查失败
openharmony_ci
openharmony_ci成员
7月18日 评论:

代码门禁未通过
您可以通过如下链接查看门禁报告:http://dcp.openharmony.cn/workbench/cicd/detail/6a5b352a64650f998b6163de/runlist

静态检查:

# check type result report
1 codeCheck noPass >>>

编译测试:
# Device build result package
1 rntpc_component pending NA

likedislike