From 1919acfa218fe38227e6212dfe3207934fca6df3 Mon Sep 17 00:00:00 2001 From: guillemc23 Date: Mon, 20 Feb 2023 02:20:28 +0100 Subject: [PATCH 1/2] fix: Icon tint --- src/fab.android.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/fab.android.ts b/src/fab.android.ts index 2a3cadc..34fa976 100644 --- a/src/fab.android.ts +++ b/src/fab.android.ts @@ -78,6 +78,22 @@ export class Fab extends FloatingActionButtonBase { // NOOP } + [colorProperty.setNative](value) { + let newValue; + if (value instanceof Color) { + newValue = android.content.res.ColorStateList.valueOf(value.android); + } + else { + newValue = value; + } + try { + this.nativeView.setSupportImageTintList(newValue); + } + catch (err) { + console.log(`Error setNative colorProperty: `, err); + } + } + [rippleColorProperty.setNative](value: Color) { this.nativeView.setRippleColor(value.android); } From 4ddaea353f4e0099c8737f0c7b534527de4df7fb Mon Sep 17 00:00:00 2001 From: guillemc23 Date: Tue, 9 May 2023 01:40:49 +0200 Subject: [PATCH 2/2] fix: Tint --- src/fab-common.ts | 5 +++++ src/index.d.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/src/fab-common.ts b/src/fab-common.ts index 829bfe9..42fed1e 100644 --- a/src/fab-common.ts +++ b/src/fab-common.ts @@ -236,3 +236,8 @@ export const androidScaleTypeProperty = new Property< affectsLayout: true, }); androidScaleTypeProperty.register(FloatingActionButtonBase); +export const colorProperty = new Property({ + name: 'color', + valueConverter: (v) => new Color(v), +}); +colorProperty.register(FloatingActionButtonBase); diff --git a/src/index.d.ts b/src/index.d.ts index 80fad58..1a6561a 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -11,5 +11,6 @@ export declare class Fab extends View { | 'scale'; public hideAnimationDuration: number; public rippleColor: Color; + public color: Color; public icon: string; }