Skip to content

Commit 49ee178

Browse files
committed
fix(image-colorfilter): property handling fix
1 parent 1f5b597 commit 49ee178

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/image-colorfilter/index-common.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,13 @@ export const colorMatrixProperty = new CssProperty<Style, number[]>({
100100
name: 'colorMatrix',
101101
cssName: 'color-matrix',
102102
valueConverter: (v) => {
103-
if (Array.isArray(v)) {
104-
return v;
105-
} else if (typeof v === 'string') {
103+
if (typeof v === 'string') {
106104
if (!v.startsWith('[')) {
107105
v = `[${v}]`;
108106
}
109107
return JSON.parse(v);
110108
}
109+
return v;
111110
}
112111
});
113112
colorMatrixProperty.register(Style);

src/image-colorfilter/index.android.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ class ImgExtended {
99
this.nativeImageViewProtected.setColorFilter(null);
1010
return;
1111
}
12-
const arr = Array.create('float', value.length);
13-
for (let index = 0; index < value.length; index++) {
14-
arr[index] = value[index];
12+
let arr = value;
13+
if (Array.isArray(value)) {
14+
arr = Array.create('float', value.length);
15+
for (let index = 0; index < value.length; index++) {
16+
arr[index] = value[index];
17+
}
1518
}
1619
this.nativeImageViewProtected.setColorFilter(new android.graphics.ColorMatrixColorFilter(arr));
1720
}

0 commit comments

Comments
 (0)