Skip to content
Open
Changes from all commits
Commits
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
20 changes: 18 additions & 2 deletions packages/webpack-plugin/lib/platform/style/wx/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ module.exports = function getSpec({ warn, error }) {
// React Native ios 不支持的 CSS property
ios: /^(vertical-align)$/,
// React Native android 不支持的 CSS property
android: /^(text-decoration-style|text-decoration-color|shadow-offset|shadow-opacity|shadow-radius)$/,
android: /^(text-decoration-color|shadow-offset|shadow-opacity|shadow-radius)$/,
// TODO: rnoh 文档暂未找到 css 属性支持说明,暂时同步 android,同时需要注意此处校验是否有缺失,类似 will-change 之类属性
harmony: /^(text-decoration-style|text-decoration-color|shadow-offset|shadow-opacity|shadow-radius)$/
harmony: /^(text-decoration-color|shadow-offset|shadow-opacity|shadow-radius|box-shadow)$/
}
// var(xx)
const cssVariableExp = /var\(/
Expand Down Expand Up @@ -596,6 +596,16 @@ module.exports = function getSpec({ warn, error }) {
}
}

// Android/Harmony 平台的 text-decoration-style 只支持 solid
const formatTextDecorationStyle = ({ prop, value, selector }, { mode }) => {
value = value.trim()
if ((mode === 'android' || mode === 'harmony') && value !== 'solid' && !cssVariableExp.test(value)) {
warn(`Property [text-decoration-style] on ${selector} only supports value "solid" in ${mode} environment, received [${value}], will use "solid" instead!`)
return { prop, value: 'solid' }
}
return verifyValues({ prop, value, selector }) && { prop, value }
}

return {
supportedModes: ['ios', 'android', 'harmony'],
rules: [
Expand Down Expand Up @@ -647,6 +657,12 @@ module.exports = function getSpec({ warn, error }) {
android: formatBorder,
harmony: formatBorder
},
{
test: 'text-decoration-style',
ios: formatTextDecorationStyle,
android: formatTextDecorationStyle,
harmony: formatTextDecorationStyle
},
// 通用的简写格式匹配
{
test: new RegExp('^(' + Object.keys(AbbreviationMap).join('|') + ')$'),
Expand Down
Loading