Skip to content

Commit 464ea18

Browse files
committed
fix(android): race condition on offBackgroundColor view change detection (#9922)
1 parent 72e096c commit 464ea18

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/core/ui/switch/index.android.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@ export class Switch extends SwitchBase {
5757
}
5858

5959
private setNativeBackgroundColor(value: string | number | Color) {
60-
if (value instanceof Color) {
61-
// todo: use https://developer.android.com/reference/androidx/core/graphics/BlendModeColorFilterCompat
62-
this.nativeViewProtected.getTrackDrawable().setColorFilter(value.android, android.graphics.PorterDuff.Mode.SRC_OVER);
63-
} else {
64-
this.nativeViewProtected.getTrackDrawable().clearColorFilter();
60+
if (this.nativeViewProtected) {
61+
if (value instanceof Color) {
62+
// todo: use https://developer.android.com/reference/androidx/core/graphics/BlendModeColorFilterCompat
63+
this.nativeViewProtected.getTrackDrawable().setColorFilter(value.android, android.graphics.PorterDuff.Mode.SRC_OVER);
64+
} else {
65+
this.nativeViewProtected.getTrackDrawable().clearColorFilter();
66+
}
6567
}
6668
}
6769

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy