fix(android): race condition on offBackgroundColor view change detection (#9922)

This commit is contained in:
Nathan Walker
2022-06-04 10:08:26 -07:00
parent 72e096c50e
commit 464ea18737

View File

@@ -57,6 +57,7 @@ export class Switch extends SwitchBase {
}
private setNativeBackgroundColor(value: string | number | Color) {
if (this.nativeViewProtected) {
if (value instanceof Color) {
// todo: use https://developer.android.com/reference/androidx/core/graphics/BlendModeColorFilterCompat
this.nativeViewProtected.getTrackDrawable().setColorFilter(value.android, android.graphics.PorterDuff.Mode.SRC_OVER);
@@ -64,6 +65,7 @@ export class Switch extends SwitchBase {
this.nativeViewProtected.getTrackDrawable().clearColorFilter();
}
}
}
_onCheckedPropertyChanged(newValue: boolean) {
super._onCheckedPropertyChanged(newValue);