Skip to content

Commit

Permalink
fix(android): prevent error because of N bug
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Nov 19, 2023
1 parent 28202de commit be1ed23
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/core/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ export function getRippleColor(color: string | Color, alpha = 0) {
if (temp.a !== 255 && alpha === 0) {
return temp.android;
}
return temp.setAlpha(alpha || 61.5).android;
// TODO: we cant use setAlpha until it is fixed in Nativescript or android will be undefined
return new Color(alpha || 61.5, temp.r, temp.g, temp.b).android;
// return temp.setAlpha(alpha || 61.5).android;
}
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ripple/ripple.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ export class Ripple extends RippleBase {
Length.toDevicePixels(this.style.borderBottomLeftRadius)
);
} else {
const nColor = getRippleColor(color, this.rippleColorAlpha)
const nColor = getRippleColor(color, this.rippleColorAlpha);
if (isPostLollipopMR1) {
(this.rippleDrawable as android.graphics.drawable.RippleDrawable).setColor(color?getColorStateList(nColor):null);
(this.rippleDrawable as android.graphics.drawable.RippleDrawable).setColor(color ? getColorStateList(nColor) : null);
} else {
(this.rippleDrawable as any).rippleShape.getPaint().setColor(nColor);
}
Expand Down

0 comments on commit be1ed23

Please sign in to comment.