Skip to content

Commit bb08cc1

Browse files
authored
Merge pull request #3011 from NativeScript/issue-3007
Fix: java.lang.NumberFormatException when applying clip-path with per…
2 parents ae48625 + 28f084e commit bb08cc1

File tree

5 files changed

+28
-1
lines changed

5 files changed

+28
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.container {
2+
width: 200;
3+
height: 200;
4+
clip-path: polygon(50% 3%, 3% 100%, 100% 100%);
5+
background-color: black;
6+
}
7+
.elementStyle {
8+
width: 200;
9+
height: 200;
10+
clip-path: polygon(50% 3%, 3% 100%, 100% 100%);
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Page id="Page" xmlns="http://schemas.nativescript.org/tns.xsd">
2+
<StackLayout id="StackLayout">
3+
<Image id="Image" width="100" height="100" class="elementStyle" src="~/ui-tests-app/image-view/gravatar.png"/>
4+
<Button id="Button" backgroundColor="blue" class="elementStyle" text="TAP" />
5+
<Label id="Label" backgroundColor="red" class="elementStyle" text="sample label" textWrap="true"/>
6+
<TextField id="TextField" backgroundColor="green" class="elementStyle" hint="" text="Sample textfield" />
7+
<TextView id="TextView" class="elementStyle" text="Sample text view" backgroundColor="yellow" editable="true" />
8+
<AbsoluteLayout id="AbsoluteLayout" class="container"/>
9+
</StackLayout>
10+
</Page>

apps/app/ui-tests-app/issues/main-page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export function pageLoaded(args: EventData) {
1414
examples.set("2911", "issues/issue-2911");
1515
examples.set("2674", "issues/issue-2674");
1616
examples.set("2942", "issues/issue-2942");
17+
examples.set("3007", "issues/issue-3007");
1718

1819
let viewModel = new SubMianPageViewModel(wrapLayout, examples);
1920
page.bindingContext = viewModel;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export module ad {
6767
_defaultBackgrounds.set(viewClass, nativeView.getBackground());
6868
}
6969

70-
backgroundDrawable = new org.nativescript.widgets.BorderDrawable(density);
70+
backgroundDrawable = new org.nativescript.widgets.BorderDrawable(density, v.toString());
7171
refreshBorderDrawable(v, <org.nativescript.widgets.BorderDrawable>backgroundDrawable);
7272
nativeView.setBackground(backgroundDrawable);
7373
}
@@ -116,6 +116,7 @@ export module ad {
116116
}
117117

118118
function refreshBorderDrawable(view: view.View, borderDrawable: org.nativescript.widgets.BorderDrawable){
119+
//console.log(`>>> refreshBorderDrawable(${view})...`);
119120
let background = <background.Background>view.style._getValue(style.backgroundInternalProperty);
120121
if (background){
121122
let backgroundPositionParsedCSSValues: native.Array<org.nativescript.widgets.CSSValue> = null;
@@ -154,6 +155,7 @@ function refreshBorderDrawable(view: view.View, borderDrawable: org.nativescript
154155
background.size,
155156
backgroundSizeParsedCSSValues
156157
);
158+
//console.log(`>>> ${borderDrawable.toDebugString()}`);
157159
}
158160
}
159161

tns-platform-declarations/android/org.nativescript.widgets.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
export class BorderDrawable extends android.graphics.drawable.ColorDrawable {
4949
constructor(density: number);
50+
constructor(density: number, id: string);
5051
public refresh(
5152
borderTopColor: number,
5253
borderRightColor: number,
@@ -104,6 +105,8 @@
104105
public hasUniformBorderWidth(): boolean;
105106
public hasUniformBorderRadius(): boolean;
106107
public hasUniformBorder(): boolean;
108+
109+
public toDebugString(): string;
107110
}
108111

109112
export class CSSValue {

0 commit comments

Comments
 (0)