fix(ios): scrollview safe area when no scroll (#6568)

This commit is contained in:
Martin Yankov
2018-11-19 09:23:06 +00:00
committed by GitHub
parent efe331862f
commit f90995f8f9
3 changed files with 6 additions and 8 deletions

View File

@ -6,7 +6,7 @@
</Page.actionBar>
<ScrollView>
<StackLayout>
<StackLayout backgroundColor="teal">
<GridLayout height="30" backgroundColor="red" />
<GridLayout height="30" backgroundColor="yellow" />
<GridLayout height="30" backgroundColor="green" />

View File

@ -7,7 +7,7 @@
<GridLayout>
<ScrollView>
<StackLayout>
<StackLayout backgroundColor="teal">
<GridLayout height="30" backgroundColor="red" />
<GridLayout height="30" backgroundColor="yellow" />
<GridLayout height="30" backgroundColor="green" />

View File

@ -164,16 +164,14 @@ export class ScrollView extends ScrollViewBase {
nativeView.contentInsetAdjustmentBehavior = 2;
}
let scrollWidth = width;
let scrollHeight = height;
let scrollWidth = width + insets.left + insets.right;
let scrollHeight = height + insets.top + insets.bottom;
if (this.orientation === "horizontal") {
scrollWidth = Math.max(this._contentMeasuredWidth + insets.left + insets.right, width);
scrollHeight = height + insets.top + insets.bottom;
scrollWidth = Math.max(this._contentMeasuredWidth + insets.left + insets.right, scrollWidth);
width = Math.max(this._contentMeasuredWidth, width);
}
else {
scrollHeight = Math.max(this._contentMeasuredHeight + insets.top + insets.bottom, height);
scrollWidth = width + insets.left + insets.right;
scrollHeight = Math.max(this._contentMeasuredHeight + insets.top + insets.bottom, scrollHeight);
height = Math.max(this._contentMeasuredHeight, height);
}