Skip to content

Commit f90995f

Browse files
authored
fix(ios): scrollview safe area when no scroll (#6568)
1 parent efe3318 commit f90995f

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

apps/app/ui-tests-app/scroll-view/safe-area-root-element.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</Page.actionBar>
77

88
<ScrollView>
9-
<StackLayout>
9+
<StackLayout backgroundColor="teal">
1010
<GridLayout height="30" backgroundColor="red" />
1111
<GridLayout height="30" backgroundColor="yellow" />
1212
<GridLayout height="30" backgroundColor="green" />

apps/app/ui-tests-app/scroll-view/safe-area-sub-element.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<GridLayout>
99
<ScrollView>
10-
<StackLayout>
10+
<StackLayout backgroundColor="teal">
1111
<GridLayout height="30" backgroundColor="red" />
1212
<GridLayout height="30" backgroundColor="yellow" />
1313
<GridLayout height="30" backgroundColor="green" />

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,14 @@ export class ScrollView extends ScrollViewBase {
164164
nativeView.contentInsetAdjustmentBehavior = 2;
165165
}
166166

167-
let scrollWidth = width;
168-
let scrollHeight = height;
167+
let scrollWidth = width + insets.left + insets.right;
168+
let scrollHeight = height + insets.top + insets.bottom;
169169
if (this.orientation === "horizontal") {
170-
scrollWidth = Math.max(this._contentMeasuredWidth + insets.left + insets.right, width);
171-
scrollHeight = height + insets.top + insets.bottom;
170+
scrollWidth = Math.max(this._contentMeasuredWidth + insets.left + insets.right, scrollWidth);
172171
width = Math.max(this._contentMeasuredWidth, width);
173172
}
174173
else {
175-
scrollHeight = Math.max(this._contentMeasuredHeight + insets.top + insets.bottom, height);
176-
scrollWidth = width + insets.left + insets.right;
174+
scrollHeight = Math.max(this._contentMeasuredHeight + insets.top + insets.bottom, scrollHeight);
177175
height = Math.max(this._contentMeasuredHeight, height);
178176
}
179177

0 commit comments

Comments
 (0)