mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(android): race condition on offBackgroundColor view change detection (#9922)
This commit is contained in:
@@ -57,11 +57,13 @@ export class Switch extends SwitchBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private setNativeBackgroundColor(value: string | number | Color) {
|
private setNativeBackgroundColor(value: string | number | Color) {
|
||||||
if (value instanceof Color) {
|
if (this.nativeViewProtected) {
|
||||||
// todo: use https://developer.android.com/reference/androidx/core/graphics/BlendModeColorFilterCompat
|
if (value instanceof Color) {
|
||||||
this.nativeViewProtected.getTrackDrawable().setColorFilter(value.android, android.graphics.PorterDuff.Mode.SRC_OVER);
|
// todo: use https://developer.android.com/reference/androidx/core/graphics/BlendModeColorFilterCompat
|
||||||
} else {
|
this.nativeViewProtected.getTrackDrawable().setColorFilter(value.android, android.graphics.PorterDuff.Mode.SRC_OVER);
|
||||||
this.nativeViewProtected.getTrackDrawable().clearColorFilter();
|
} else {
|
||||||
|
this.nativeViewProtected.getTrackDrawable().clearColorFilter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user