From e1828d56cd1d6c59e2ef2aa88706ad670cd287fd Mon Sep 17 00:00:00 2001 From: Vasil Chimev Date: Tue, 4 Sep 2018 11:26:20 +0300 Subject: [PATCH] refactor: rename iosExpandSafeArea to iosOverflowSafeArea Update type definitions. --- .../app/expand/fragments/grid-3x3-fragment.xml | 2 +- tns-core-modules/ui/core/view/view-common.ts | 10 +++++----- tns-core-modules/ui/core/view/view.android.ts | 2 +- tns-core-modules/ui/core/view/view.d.ts | 12 +++++++++++- tns-core-modules/ui/core/view/view.ios.ts | 6 +++--- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/e2e/safe-area/app/expand/fragments/grid-3x3-fragment.xml b/e2e/safe-area/app/expand/fragments/grid-3x3-fragment.xml index 41da31d83..ee5bb9b97 100644 --- a/e2e/safe-area/app/expand/fragments/grid-3x3-fragment.xml +++ b/e2e/safe-area/app/expand/fragments/grid-3x3-fragment.xml @@ -1,4 +1,4 @@ - + diff --git a/tns-core-modules/ui/core/view/view-common.ts b/tns-core-modules/ui/core/view/view-common.ts index 6374792ab..c3a7d4b28 100644 --- a/tns-core-modules/ui/core/view/view-common.ts +++ b/tns-core-modules/ui/core/view/view-common.ts @@ -586,7 +586,7 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition { public originY: number; public isEnabled: boolean; public isUserInteractionEnabled: boolean; - public iosExpandSafeArea: boolean; + public iosOverflowSafeArea: boolean; get isLayoutValid(): boolean { return this._isLayoutValid; @@ -1006,9 +1006,6 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition { } } -export const iosExpandSafeAreaProperty = new Property({ name: "iosExpandSafeArea", defaultValue: false, valueConverter: booleanConverter }); -iosExpandSafeAreaProperty.register(ViewCommon); - export const automationTextProperty = new Property({ name: "automationText" }); automationTextProperty.register(ViewCommon); @@ -1029,4 +1026,7 @@ export const isEnabledProperty = new Property({ isEnabledProperty.register(ViewCommon); export const isUserInteractionEnabledProperty = new Property({ name: "isUserInteractionEnabled", defaultValue: true, valueConverter: booleanConverter }); -isUserInteractionEnabledProperty.register(ViewCommon); \ No newline at end of file +isUserInteractionEnabledProperty.register(ViewCommon); + +export const iosOverflowSafeAreaProperty = new Property({ name: "iosOverflowSafeArea", defaultValue: false, valueConverter: booleanConverter }); +iosOverflowSafeAreaProperty.register(ViewCommon); diff --git a/tns-core-modules/ui/core/view/view.android.ts b/tns-core-modules/ui/core/view/view.android.ts index 525483125..024c3909d 100644 --- a/tns-core-modules/ui/core/view/view.android.ts +++ b/tns-core-modules/ui/core/view/view.android.ts @@ -805,7 +805,7 @@ export class View extends ViewCommon { } export class ContainerView extends View { - public iosExpandSafeArea: boolean; + public iosOverflowSafeArea: boolean; } export class CustomLayoutView extends ContainerView implements CustomLayoutViewDefinition { diff --git a/tns-core-modules/ui/core/view/view.d.ts b/tns-core-modules/ui/core/view/view.d.ts index c8557672b..0ea4b37ea 100644 --- a/tns-core-modules/ui/core/view/view.d.ts +++ b/tns-core-modules/ui/core/view/view.d.ts @@ -344,6 +344,11 @@ export abstract class View extends ViewBase { */ isUserInteractionEnabled: boolean; + /** + * Instruct container view to expand beyond the safe area. This property is iOS specific. Default value: false + */ + iosOverflowSafeArea: boolean; + /** * Gets is layout is valid. This is a read-only property. */ @@ -707,7 +712,7 @@ export class ContainerView extends View { /** * Instruct container view to expand beyond the safe area. This property is iOS specific. Default value: true */ - public iosExpandSafeArea: boolean; + public iosOverflowSafeArea: boolean; } /** @@ -787,6 +792,7 @@ export const originXProperty: Property; export const originYProperty: Property; export const isEnabledProperty: Property; export const isUserInteractionEnabledProperty: Property; +export const iosOverflowSafeAreaProperty: Property; export namespace ios { /** @@ -797,6 +803,10 @@ export namespace ios { export function updateAutoAdjustScrollInsets(controller: any /* UIViewController */, owner: View): void export function updateConstraints(controller: any /* UIViewController */, owner: View): void; export function layoutView(controller: any /* UIViewController */, owner: View): void; + export function getPositionFromFrame(frame: any /* CGRect */): { left, top, right, bottom }; + export function getFrameFromPosition(position: { left, top, right, bottom }, insets?: { left, top, right, bottom }): any /* CGRect */; + export function shrinkToSafeArea(view: View, frame: any /* CGRect */): any /* CGRect */; + export function expandBeyondSafeArea(view: View, frame: any /* CGRect */): any /* CGRect */; export class UILayoutViewController { public static initWithOwner(owner: WeakRef): UILayoutViewController; } diff --git a/tns-core-modules/ui/core/view/view.ios.ts b/tns-core-modules/ui/core/view/view.ios.ts index 162050467..27e166fab 100644 --- a/tns-core-modules/ui/core/view/view.ios.ts +++ b/tns-core-modules/ui/core/view/view.ios.ts @@ -225,7 +225,7 @@ export class View extends ViewCommon { return null; } - if (!this.iosExpandSafeArea) { + if (!this.iosOverflowSafeArea) { return ios.shrinkToSafeArea(this, frame); } else if (this.nativeViewProtected && this.nativeViewProtected.window) { return ios.expandBeyondSafeArea(this, frame); @@ -579,11 +579,11 @@ View.prototype._nativeBackgroundState = "unset"; export class ContainerView extends View { - public iosExpandSafeArea: boolean; + public iosOverflowSafeArea: boolean; constructor() { super(); - this.iosExpandSafeArea = true; + this.iosOverflowSafeArea = true; } }