mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 22:01:42 +08:00
fix: automated tests are now passing
This commit is contained in:
@ -225,7 +225,16 @@ export class ActionBar extends ActionBarBase {
|
|||||||
const nativeView = this.nativeViewProtected;
|
const nativeView = this.nativeViewProtected;
|
||||||
if (backgroundDrawable && onlyColor && sdkVersion() >= 21) {
|
if (backgroundDrawable && onlyColor && sdkVersion() >= 21) {
|
||||||
if (isBorderDrawable && (<any>nativeView)._cachedDrawable) {
|
if (isBorderDrawable && (<any>nativeView)._cachedDrawable) {
|
||||||
backgroundDrawable = (<any>nativeView)._cachedDrawable.newDrawable(nativeView.getResources());
|
backgroundDrawable = (<any>nativeView)._cachedDrawable;
|
||||||
|
// we need to duplicate the drawable or we lose the "default" cached drawable
|
||||||
|
const constantState = backgroundDrawable.getConstantState();
|
||||||
|
if (constantState) {
|
||||||
|
try {
|
||||||
|
backgroundDrawable = constantState.newDrawable(nativeView.getResources());
|
||||||
|
// eslint-disable-next-line no-empty
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
nativeView.setBackground(backgroundDrawable);
|
||||||
nativeView.setBackground(backgroundDrawable);
|
nativeView.setBackground(backgroundDrawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,10 +62,17 @@ export class Button extends ButtonBase {
|
|||||||
|
|
||||||
public _applyBackground(background: Background, isBorderDrawable, onlyColor: boolean, backgroundDrawable: any) {
|
public _applyBackground(background: Background, isBorderDrawable, onlyColor: boolean, backgroundDrawable: any) {
|
||||||
const nativeView = this.nativeViewProtected;
|
const nativeView = this.nativeViewProtected;
|
||||||
console.log('_applyBackground', nativeView, backgroundDrawable, onlyColor, isBorderDrawable);
|
|
||||||
if (backgroundDrawable && onlyColor) {
|
if (backgroundDrawable && onlyColor) {
|
||||||
if (isBorderDrawable && (<any>nativeView)._cachedDrawable) {
|
if (isBorderDrawable && (<any>nativeView)._cachedDrawable) {
|
||||||
backgroundDrawable = (<any>nativeView)._cachedDrawable.newDrawable(nativeView.getResources());
|
backgroundDrawable = (<any>nativeView)._cachedDrawable;
|
||||||
|
// we need to duplicate the drawable or we lose the "default" cached drawable
|
||||||
|
const constantState = backgroundDrawable.getConstantState();
|
||||||
|
if (constantState) {
|
||||||
|
try {
|
||||||
|
backgroundDrawable = constantState.newDrawable(nativeView.getResources());
|
||||||
|
// eslint-disable-next-line no-empty
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
nativeView.setBackground(backgroundDrawable);
|
nativeView.setBackground(backgroundDrawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -996,7 +996,7 @@ export class View extends ViewCommon {
|
|||||||
if (constantState) {
|
if (constantState) {
|
||||||
try {
|
try {
|
||||||
drawable = constantState.newDrawable(nativeView.getResources());
|
drawable = constantState.newDrawable(nativeView.getResources());
|
||||||
// eslint-disable-next-line no-empty
|
// eslint-disable-next-line no-empty
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user