mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix: android ActivityIndicator custom color affecting other indicators on the page (#9026)
* fix(core): Setting color of an Android ActivityIndicator changed the color of the rest of ActivityIndicators in the same page. * test: Updated ActivityIndicator sample. * perf: Call mutate() only if color is actually changed.
This commit is contained in:
committed by
GitHub
parent
d09a564296
commit
e16bc606ef
@@ -47,10 +47,12 @@ export class ActivityIndicator extends ActivityIndicatorBase {
|
||||
return -1;
|
||||
}
|
||||
[colorProperty.setNative](value: number | Color) {
|
||||
if (value instanceof Color) {
|
||||
this.nativeViewProtected.getIndeterminateDrawable().setColorFilter(value.android, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
const color = value instanceof Color ? value.android : value;
|
||||
const drawable = this.nativeViewProtected.getIndeterminateDrawable().mutate();
|
||||
if (color) {
|
||||
drawable.setColorFilter(color, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
} else {
|
||||
this.nativeViewProtected.getIndeterminateDrawable().clearColorFilter();
|
||||
drawable.clearColorFilter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user