-
Notifications
You must be signed in to change notification settings - Fork 370
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 react style #1457
Feat react style #1457
Conversation
// RN 不支持的颜色格式 | ||
const colorRegExp = /^\s*(lab|lch|oklab|oklch|color-mix|color|hwb|lch|light-dark).*$/ | ||
|
||
function verifyValues ({ prop, value, valueType }) { |
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.
统一为const xx = ()=>{}的方式定义吧
const unsupportedValueError = ({ prop, value }) => { | ||
if (isIllegalValue({ prop, value })) { | ||
const content = `Property [${prop}] only support value [${SUPPORTED_PROP_VAL_ARR[prop]?.join(',')}] in React Native environment, the value [${value}] does not support!` | ||
error(content) |
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.
考虑移除不支持的属性
needStringify = false | ||
if (cssPrefixExp.test(prop) || cssPrefixExp.test(value)) return | ||
let newData = rulesRunner({ prop, value }) | ||
if (!newData.length) { |
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.
建议使用Array.isArray判断数组
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.
同时判断newData为false时直接return移除该属性
newData.forEach(item => { | ||
prop = dash2hump(item.prop) | ||
value = item.value | ||
if (!value) return |
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.
逻辑不严谨,建议使用显式返回false移除,当前逻辑会把width:0这样的合法属性误删
No description provided.