mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-04 11:04:58 +00:00
Remove '!important' check from setValueForStyles
'!important' styles are no longer used internally and are not supported in the public API.
This commit is contained in:
@@ -28,8 +28,6 @@ function setValueForStyles(node, styles, getStack) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const isCustomProperty = styleName.indexOf('--') === 0;
|
const isCustomProperty = styleName.indexOf('--') === 0;
|
||||||
const isImportant =
|
|
||||||
typeof styles[styleName] === 'string' && styles[styleName].indexOf('!important') > -1;
|
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
if (!isCustomProperty) {
|
if (!isCustomProperty) {
|
||||||
warnValidStyle(styleName, styles[styleName], getStack);
|
warnValidStyle(styleName, styles[styleName], getStack);
|
||||||
@@ -39,14 +37,9 @@ function setValueForStyles(node, styles, getStack) {
|
|||||||
if (styleName === 'float') {
|
if (styleName === 'float') {
|
||||||
styleName = 'cssFloat';
|
styleName = 'cssFloat';
|
||||||
}
|
}
|
||||||
if (isCustomProperty || isImportant) {
|
if (isCustomProperty) {
|
||||||
const name = isCustomProperty ? styleName : hyphenateStyleName(styleName);
|
const name = isCustomProperty ? styleName : hyphenateStyleName(styleName);
|
||||||
if (isImportant) {
|
style.setProperty(name, styleValue);
|
||||||
const [value, priority] = styleValue.split('!');
|
|
||||||
style.setProperty(name, value, priority);
|
|
||||||
} else {
|
|
||||||
style.setProperty(name, styleValue);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
style[styleName] = styleValue;
|
style[styleName] = styleValue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user