Skip to content

Commit 1eadcd9

Browse files
committed
fix(colorfilter): support null value
1 parent a4c9dc9 commit 1eadcd9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/image-colorfilter/index.android.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ class ImgExtended {
55
nativeImageViewProtected: com.nativescript.image.DraweeView;
66
@cssProperty colorMatrix: number[];
77
[colorMatrixProperty.setNative](value: number[]) {
8+
if (!value) {
9+
this.nativeImageViewProtected.setColorFilter(null);
10+
return;
11+
}
812
const arr = Array.create('float', value.length);
913
for (let index = 0; index < value.length; index++) {
1014
arr[index] = value[index];

src/image-colorfilter/index.ios.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class ImgExtended3 {
4444
_filter: CIFilter;
4545

4646
filteredImage(image: UIImage, filter: CIFilter) {
47-
if (image !== null) {
47+
if (image !== null && filter !== null) {
4848
const tmp = CIImage.alloc().initWithImage(image);
4949
this._filter.setValueForKey(tmp, 'inputImage');
5050

@@ -55,7 +55,7 @@ class ImgExtended3 {
5555
// CGImageRelease(cgim);
5656
return filteredImage;
5757
}
58-
return null;
58+
return image;
5959
}
6060
_applyColorFilter(image) {
6161
if (image) {

0 commit comments

Comments
 (0)