fix(ios): Color.fromIosColor returns wrong value (#10059)

This commit is contained in:
Mohamed Akram
2022-11-08 05:51:50 +04:00
committed by GitHub
parent 0f7e4ed0f3
commit b7d340f69b
5 changed files with 29 additions and 3 deletions

View File

@@ -13,8 +13,11 @@ export class Color extends common.Color {
}
public static fromIosColor(value: UIColor): Color {
const rgba = CGColorGetComponents(value.CGColor);
return new Color(Math.round(rgba[3] * 255), Math.round(rgba[0] * 255), Math.round(rgba[1] * 255), Math.round(rgba[2] * 255));
const r = new interop.Reference<number>();
const g = new interop.Reference<number>();
const b = new interop.Reference<number>();
const a = new interop.Reference<number>();
value.getRedGreenBlueAlpha(r, g, b, a);
return new Color(Math.round(a.value * 255), Math.round(r.value * 255), Math.round(g.value * 255), Math.round(b.value * 255));
}
}