Skip to content

Commit f29f7cb

Browse files
author
vakrilov
committed
Always set clipToBounds for images, list-view and scroll-view
1 parent cc96fd0 commit f29f7cb

File tree

4 files changed

+36
-19
lines changed

4 files changed

+36
-19
lines changed
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<Page>
22
<GridLayout rows="*,*,*,*,*,*" columns="*,*,*,">
3-
<TextView id="s0" row="0" col="0" textWrap="true" text="border-width: 5;"/>
4-
<TextView id="s1" row="0" col="1" textWrap="true" text="border-width: 5; border-color: red;"/>
5-
<TextView id="s2" row="0" col="2" textWrap="true" text="border-width: 5; border-color: red red red green;"/>
6-
<TextView id="s3" row="1" col="0" textWrap="true" text="border-width: 5; border-color: red; border-radius: 5;"/>
7-
<TextView id="s4" row="1" col="1" textWrap="true" text="border-width: 5; border-color: red; border-radius: 50;"/>
8-
<TextView id="s5" row="1" col="2" textWrap="true" text="border-width: 5 10 15 20; border-color: green;"/>
9-
<TextView id="s6" row="2" col="0" textWrap="true" text="border-width: 5; border-color: red green blue yellow;"/>
10-
<TextView id="s7" row="2" col="1" textWrap="true" text="border-width: 5 10 15 20; border-color: red green blue yellow;"/>
11-
<TextView id="s8" row="2" col="2" textWrap="true" text="border-width: 5 10; border-color: red green;"/>
12-
<TextView id="s9" row="3" col="0" textWrap="true" text="border-width: 15 10 5; border-color: red green blue;"/>
13-
<TextView id="s10" row="3" col="1" textWrap="true" text="border-width: 5 0; border-color: black;"/>
14-
<TextView id="s11" row="3" col="2" textWrap="true" text="background-color: magenta;"/>
15-
<TextView id="s12" row="4" col="0" textWrap="true" text="border-width: 5 10 15 20; border-color: red green blue yellow; border-radius: 5 10 15 20;"/>
16-
<TextView id="s13" row="4" col="1" textWrap="true" text="border-width: 5 10 15 20; border-color: red green blue yellow; border-radius: 5;"/>
17-
<TextView id="s14" row="4" col="2" textWrap="true" text="border-width: 5 10 15 20; border-color: red green blue yellow; background-color: magenta;"/>
18-
<TextView id="s15" row="5" col="0" textWrap="true" text="border-width: 5 10 15 20; border-color: red green blue yellow; background-image: url('~/ui-tests-app/pages/test2.png');"/>
19-
<TextView id="s16" row="5" col="1" textWrap="true" text="border-width: 5; border-color: red; padding: 5;"/>
20-
<TextView id="s17" row="5" col="2" textWrap="true" text="border-width: 5 6 7 8; border-color: red green blue yellow; padding: 5 6 7 8;"/>
3+
<TextView id="s0" row="0" col="0" textWrap="true" autocorrect="false" text="border-width: 5;"/>
4+
<TextView id="s1" row="0" col="1" textWrap="true" autocorrect="false" text="border-width: 5; border-color: red;"/>
5+
<TextView id="s2" row="0" col="2" textWrap="true" autocorrect="false" text="border-width: 5; border-color: red red red green;"/>
6+
<TextView id="s3" row="1" col="0" textWrap="true" autocorrect="false" text="border-width: 5; border-color: red; border-radius: 5;"/>
7+
<TextView id="s4" row="1" col="1" textWrap="true" autocorrect="false" text="border-width: 5; border-color: red; border-radius: 50;"/>
8+
<TextView id="s5" row="1" col="2" textWrap="true" autocorrect="false" text="border-width: 5 10 15 20; border-color: green;"/>
9+
<TextView id="s6" row="2" col="0" textWrap="true" autocorrect="false" text="border-width: 5; border-color: red green blue yellow;"/>
10+
<TextView id="s7" row="2" col="1" textWrap="true" autocorrect="false" text="border-width: 5 10 15 20; border-color: red green blue yellow;"/>
11+
<TextView id="s8" row="2" col="2" textWrap="true" autocorrect="false" text="border-width: 5 10; border-color: red green;"/>
12+
<TextView id="s9" row="3" col="0" textWrap="true" autocorrect="false" text="border-width: 15 10 5; border-color: red green blue;"/>
13+
<TextView id="s10" row="3" col="1" textWrap="true" autocorrect="false" text="border-width: 5 0; border-color: black;"/>
14+
<TextView id="s11" row="3" col="2" textWrap="true" autocorrect="false" text="background-color: magenta;"/>
15+
<TextView id="s12" row="4" col="0" textWrap="true" autocorrect="false" text="border-width: 5 10 15 20; border-color: red green blue yellow; border-radius: 5 10 15 20;"/>
16+
<TextView id="s13" row="4" col="1" textWrap="true" autocorrect="false" text="border-width: 5 10 15 20; border-color: red green blue yellow; border-radius: 5;"/>
17+
<TextView id="s14" row="4" col="2" textWrap="true" autocorrect="false" text="border-width: 5 10 15 20; border-color: red green blue yellow; background-color: magenta;"/>
18+
<TextView id="s15" row="5" col="0" textWrap="true" autocorrect="false" text="border-width: 5 10 15 20; border-color: red green blue yellow; background-image: url('~/ui-tests-app/pages/test2.png');"/>
19+
<TextView id="s16" row="5" col="1" textWrap="true" autocorrect="false" text="border-width: 5; border-color: red; padding: 5;"/>
20+
<TextView id="s17" row="5" col="2" textWrap="true" autocorrect="false" text="border-width: 5 6 7 8; border-color: red green blue yellow; padding: 5 6 7 8;"/>
2121
</GridLayout>
2222
</Page>

tns-core-modules/ui/image/image.ios.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export class Image extends ImageBase {
1616
//TODO: Think of unified way of setting all the default values.
1717
this._ios = UIImageView.new();
1818
this._ios.contentMode = UIViewContentMode.ScaleAspectFit;
19-
this._ios.clipsToBounds = true;
2019
this._ios.userInteractionEnabled = true;
20+
this._setNativeClipToBounds();
2121
}
2222

2323
get ios(): UIImageView {
@@ -45,6 +45,11 @@ export class Image extends ImageBase {
4545
}
4646
}
4747

48+
_setNativeClipToBounds() {
49+
// Always set clipsToBounds for images
50+
this._ios.clipsToBounds = true;
51+
}
52+
4853
public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void {
4954
// We don't call super because we measure native view with specific size.
5055
let width = layout.getMeasureSpecSize(widthMeasureSpec);

tns-core-modules/ui/list-view/list-view.ios.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ export class ListView extends ListViewBase {
217217
this._delegate = UITableViewDelegateImpl.initWithOwner(new WeakRef(this));
218218
this._heights = new Array<number>();
219219
this._map = new Map<ListViewCell, View>();
220+
this._setNativeClipToBounds();
221+
}
222+
223+
_setNativeClipToBounds() {
224+
// Always set clipsToBounds for list-view
225+
this._ios.clipsToBounds = true;
220226
}
221227

222228
public onLoaded() {

tns-core-modules/ui/scroll-view/scroll-view.ios.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ export class ScrollView extends ScrollViewBase {
3636
constructor() {
3737
super();
3838
this.nativeView = UIScrollView.new();
39+
this._setNativeClipToBounds();
40+
}
41+
42+
_setNativeClipToBounds() {
43+
// Always set clipsToBounds for scroll-view
44+
this.nativeView.clipsToBounds = true;
3945
}
4046

4147
protected attachNative() {

0 commit comments

Comments
 (0)