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> </Page.actionBar>
<ScrollView> <ScrollView>
<StackLayout> <StackLayout backgroundColor="teal">
<GridLayout height="30" backgroundColor="red" /> <GridLayout height="30" backgroundColor="red" />
<GridLayout height="30" backgroundColor="yellow" /> <GridLayout height="30" backgroundColor="yellow" />
<GridLayout height="30" backgroundColor="green" /> <GridLayout height="30" backgroundColor="green" />

View File

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

View File

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