From f90995f8f90ca8bd383eaf92eb1c6aeac6516d6e Mon Sep 17 00:00:00 2001 From: Martin Yankov Date: Mon, 19 Nov 2018 09:23:06 +0000 Subject: [PATCH] fix(ios): scrollview safe area when no scroll (#6568) --- .../scroll-view/safe-area-root-element.xml | 2 +- .../ui-tests-app/scroll-view/safe-area-sub-element.xml | 2 +- tns-core-modules/ui/scroll-view/scroll-view.ios.ts | 10 ++++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/apps/app/ui-tests-app/scroll-view/safe-area-root-element.xml b/apps/app/ui-tests-app/scroll-view/safe-area-root-element.xml index 0d63dc6c6..668c51055 100644 --- a/apps/app/ui-tests-app/scroll-view/safe-area-root-element.xml +++ b/apps/app/ui-tests-app/scroll-view/safe-area-root-element.xml @@ -6,7 +6,7 @@ - + diff --git a/apps/app/ui-tests-app/scroll-view/safe-area-sub-element.xml b/apps/app/ui-tests-app/scroll-view/safe-area-sub-element.xml index 860aca976..3d4b43732 100644 --- a/apps/app/ui-tests-app/scroll-view/safe-area-sub-element.xml +++ b/apps/app/ui-tests-app/scroll-view/safe-area-sub-element.xml @@ -7,7 +7,7 @@ - + diff --git a/tns-core-modules/ui/scroll-view/scroll-view.ios.ts b/tns-core-modules/ui/scroll-view/scroll-view.ios.ts index 717e5851f..f99e8b635 100644 --- a/tns-core-modules/ui/scroll-view/scroll-view.ios.ts +++ b/tns-core-modules/ui/scroll-view/scroll-view.ios.ts @@ -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); }