Skip to content

Commit be1ed23

Browse files
committed
fix(android): prevent error because of N bug
NativeScript/NativeScript#10441
1 parent 28202de commit be1ed23

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/core/index.android.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ export function getRippleColor(color: string | Color, alpha = 0) {
203203
if (temp.a !== 255 && alpha === 0) {
204204
return temp.android;
205205
}
206-
return temp.setAlpha(alpha || 61.5).android;
206+
// TODO: we cant use setAlpha until it is fixed in Nativescript or android will be undefined
207+
return new Color(alpha || 61.5, temp.r, temp.g, temp.b).android;
208+
// return temp.setAlpha(alpha || 61.5).android;
207209
}
208210
return null;
209211
}

src/ripple/ripple.android.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ export class Ripple extends RippleBase {
231231
Length.toDevicePixels(this.style.borderBottomLeftRadius)
232232
);
233233
} else {
234-
const nColor = getRippleColor(color, this.rippleColorAlpha)
234+
const nColor = getRippleColor(color, this.rippleColorAlpha);
235235
if (isPostLollipopMR1) {
236-
(this.rippleDrawable as android.graphics.drawable.RippleDrawable).setColor(color?getColorStateList(nColor):null);
236+
(this.rippleDrawable as android.graphics.drawable.RippleDrawable).setColor(color ? getColorStateList(nColor) : null);
237237
} else {
238238
(this.rippleDrawable as any).rippleShape.getPaint().setColor(nColor);
239239
}

0 commit comments

Comments
 (0)