diff --git a/tns-core-modules/ui/core/view-common.ts b/tns-core-modules/ui/core/view-common.ts index 917a00de5..e96097228 100644 --- a/tns-core-modules/ui/core/view-common.ts +++ b/tns-core-modules/ui/core/view-common.ts @@ -914,6 +914,10 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition { this.effectiveMarginTop = PercentLength.toDevicePixels(style.marginTop, 0, parentAvailableHeight); this.effectiveMarginBottom = PercentLength.toDevicePixels(style.marginBottom, 0, parentAvailableHeight); } + + public _setNativeClipToBounds() { + // + } } ViewCommon.prototype._oldLeft = 0; diff --git a/tns-core-modules/ui/core/view.ios.ts b/tns-core-modules/ui/core/view.ios.ts index 00e1e8a6e..982c42362 100644 --- a/tns-core-modules/ui/core/view.ios.ts +++ b/tns-core-modules/ui/core/view.ios.ts @@ -13,6 +13,12 @@ const PFLAG_FORCE_LAYOUT = 1; const PFLAG_MEASURED_DIMENSION_SET = 1 << 1; const PFLAG_LAYOUT_REQUIRED = 1 << 2; +declare module "ui/core/view" { + export interface View { + _setNativeClipToBounds(); + } +} + export class View extends ViewCommon { private _hasTransfrom = false; private _privateFlags: number = PFLAG_LAYOUT_REQUIRED | PFLAG_FORCE_LAYOUT; @@ -397,11 +403,17 @@ export class View extends ViewCommon { this.nativeView.backgroundColor = value; } else { this.nativeView.backgroundColor = ios.createBackgroundUIColor(this); + this._setNativeClipToBounds(); } if (!updateSuspended) { CATransaction.commit(); } } + + _setNativeClipToBounds() { + let backgroundInternal = this.style.backgroundInternal; + this.nativeView.clipsToBounds = backgroundInternal.hasUniformBorder() || backgroundInternal.getUniformBorderRadius() > 0; + } } export class CustomLayoutView extends View { diff --git a/tns-core-modules/ui/layouts/layout-base.ios.ts b/tns-core-modules/ui/layouts/layout-base.ios.ts index 0d8ff3e55..4b32bccee 100644 --- a/tns-core-modules/ui/layouts/layout-base.ios.ts +++ b/tns-core-modules/ui/layouts/layout-base.ios.ts @@ -3,11 +3,19 @@ export * from "./layout-base-common"; export class LayoutBase extends LayoutBaseCommon { - + get [clipToBoundsProperty.native](): boolean { - return this._nativeView.clipsToBounds; + return false; } set [clipToBoundsProperty.native](value: boolean) { - this._nativeView.clipsToBounds = value; + this._setNativeClipToBounds(); + } + + _setNativeClipToBounds() { + if (this.clipToBounds) { + this._nativeView.clipsToBounds = true; + } else { + super._setNativeClipToBounds(); + } } } \ No newline at end of file diff --git a/tns-core-modules/ui/styling/background.ios.ts b/tns-core-modules/ui/styling/background.ios.ts index 471b23045..856586031 100644 --- a/tns-core-modules/ui/styling/background.ios.ts +++ b/tns-core-modules/ui/styling/background.ios.ts @@ -164,7 +164,6 @@ function drawNonUniformBorders(nativeView: NativeView, background: Background) { layer.borderColor = undefined; layer.borderWidth = 0; layer.cornerRadius = 0; - nativeView.clipsToBounds = true; const layerBounds = layer.bounds; const layerOrigin = layerBounds.origin;