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 react style #1457

Merged
merged 47 commits into from
May 23, 2024
Merged

Feat react style #1457

merged 47 commits into from
May 23, 2024

Conversation

wenwenhua
Copy link
Collaborator

No description provided.

// RN 不支持的颜色格式
const colorRegExp = /^\s*(lab|lch|oklab|oklch|color-mix|color|hwb|lch|light-dark).*$/

function verifyValues ({ prop, value, valueType }) {
Copy link
Collaborator

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)
Copy link
Collaborator

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) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

建议使用Array.isArray判断数组

Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

逻辑不严谨,建议使用显式返回false移除,当前逻辑会把width:0这样的合法属性误删

@hiyuki hiyuki merged commit a3cd2ee into feat-react May 23, 2024
4 checks passed
@hiyuki hiyuki deleted the feat-react-style branch May 23, 2024 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants