Skip to content

Commit ad05f55

Browse files
committed
Fix: background-repeat is not respected
Related to NativeScript#2318
1 parent e61affc commit ad05f55

File tree

1 file changed

+16
-36
lines changed

1 file changed

+16
-36
lines changed

tns-core-modules/ui/styling/background.android.ts

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -110,50 +110,30 @@ export module ad {
110110

111111
function refreshBorderDrawable(view: view.View, borderDrawable: org.nativescript.widgets.BorderDrawable){
112112
let background = <background.Background>view.style._getValue(style.backgroundInternalProperty);
113-
let borderWidth: number = view.borderWidth;
114-
let borderColor: number = 0;
115-
if (view.borderColor && view.borderColor.android){
116-
borderColor = view.borderColor.android;
117-
}
118-
let borderRadius: number = view.borderRadius;
119-
let clipPath: string = view.style._getValue(style.clipPathProperty);
120-
let backgroundColor: number = 0;
121-
let backgroundImage: android.graphics.Bitmap = null;
122-
let backgroundRepeat: string = null;
123-
let backgroundPosition: string = null;
124-
let backgroundPositionParsedCSSValues: native.Array<org.nativescript.widgets.CSSValue> = null;
125-
let backgroundSize: string = null;
126-
let backgroundSizeParsedCSSValues: native.Array<org.nativescript.widgets.CSSValue> = null;
127113
if (background){
128-
if (background.color && background.color.android){
129-
backgroundColor = background.color.android;
130-
}
131-
if (background.image && background.image.android){
132-
backgroundImage = background.image.android;
133-
}
114+
let backgroundPositionParsedCSSValues: native.Array<org.nativescript.widgets.CSSValue> = null;
115+
let backgroundSizeParsedCSSValues: native.Array<org.nativescript.widgets.CSSValue> = null;
134116
if (background.position){
135-
backgroundPosition = background.position;
136117
backgroundPositionParsedCSSValues = createNativeCSSValueArray(background.position);
137118
}
138119
if (background.size){
139-
backgroundSize = background.size;
140120
backgroundSizeParsedCSSValues = createNativeCSSValueArray(background.size);
141121
}
122+
123+
borderDrawable.refresh(
124+
background.borderWidth,
125+
(background.borderColor && background.borderColor.android) ? background.borderColor.android : 0,
126+
background.borderRadius,
127+
background.clipPath,
128+
(background.color && background.color.android) ? background.color.android : 0,
129+
(background.image && background.image.android) ? background.image.android : null,
130+
background.repeat,
131+
background.position,
132+
backgroundPositionParsedCSSValues,
133+
background.size,
134+
backgroundSizeParsedCSSValues
135+
);
142136
}
143-
144-
borderDrawable.refresh(
145-
borderWidth,
146-
borderColor,
147-
borderRadius,
148-
clipPath,
149-
backgroundColor,
150-
backgroundImage,
151-
backgroundRepeat,
152-
backgroundPosition,
153-
backgroundPositionParsedCSSValues,
154-
backgroundSize,
155-
backgroundSizeParsedCSSValues
156-
);
157137
}
158138

159139
function createNativeCSSValueArray(css: string): native.Array<org.nativescript.widgets.CSSValue>{

0 commit comments

Comments
 (0)