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,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();
}
} }
} }