Skip to content

Commit 1346a15

Browse files
situ2001open-hippy
andauthored
fix(js): should properly update styles (#4413)
* fix(js): should properly update styles * fix(js): use safer validation logic for style --------- Co-authored-by: OpenHippy <[email protected]>
1 parent a8fbe9e commit 1346a15

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

driver/js/packages/hippy-react/src/dom/element-node.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,14 @@ class ElementNode extends ViewNode {
485485
{
486486
match: () => ['style'].indexOf(key) >= 0,
487487
action: () => {
488-
if (typeof value !== 'object' || value === undefined || value === null) {
488+
const isArray = Array.isArray(value);
489+
const isObject = typeof value === 'object' && value !== null;
490+
const isUndefined = typeof value === 'undefined';
491+
492+
if (!(isArray || isObject || isUndefined)) {
489493
return true;
490494
}
495+
491496
this.setStyleAttribute(value);
492497
const inheritProperties = ['color', 'fontSize', 'fontWeight', 'fontFamily', 'fontStyle', 'textAlign', 'lineHeight'];
493498
const needInherit = inheritProperties.some(prop => Object.prototype.hasOwnProperty.call(value, prop));

0 commit comments

Comments
 (0)