diff --git a/packages/core/ui/core/view-base/index.ts b/packages/core/ui/core/view-base/index.ts index b25d6e5867..f421d6f6d5 100644 --- a/packages/core/ui/core/view-base/index.ts +++ b/packages/core/ui/core/view-base/index.ts @@ -1049,8 +1049,9 @@ export abstract class ViewBase extends Observable { @profile public requestLayout(): void { // Default implementation for non View instances (like TabViewItem). + // The parent can have no layout to request: the one of a Span is a FormattedString. const parent = this.parent; - if (parent) { + if (typeof parent?.requestLayout === 'function') { this.performLayout(); } } diff --git a/packages/core/ui/scroll-view/index.android.ts b/packages/core/ui/scroll-view/index.android.ts index 3b273f5436..55c192ab53 100644 --- a/packages/core/ui/scroll-view/index.android.ts +++ b/packages/core/ui/scroll-view/index.android.ts @@ -1,5 +1,5 @@ import type { ScrollEventData } from './scroll-view-common'; -import { ScrollViewBase, scrollBarIndicatorVisibleProperty, isScrollEnabledProperty } from './scroll-view-common'; +import { ScrollViewBase, clipToBoundsProperty, scrollBarIndicatorVisibleProperty, isScrollEnabledProperty } from './scroll-view-common'; import { layout } from '../../utils'; import { isUserInteractionEnabledProperty } from '../core/view'; @@ -54,6 +54,10 @@ export class ScrollView extends ScrollViewBase { this.nativeViewProtected.setScrollEnabled(value); } + [clipToBoundsProperty.setNative](value: boolean) { + this.nativeViewProtected.setClipChildren(value); + } + [isScrollEnabledProperty.getDefault](): boolean { return this.nativeViewProtected.getScrollEnabled(); } diff --git a/packages/core/ui/scroll-view/index.d.ts b/packages/core/ui/scroll-view/index.d.ts index 59aa6dd4b8..e5c21cca20 100644 --- a/packages/core/ui/scroll-view/index.d.ts +++ b/packages/core/ui/scroll-view/index.d.ts @@ -83,6 +83,15 @@ export class ScrollView extends ContentView { */ iosContentInsetAdjustmentBehavior: 'never' | 'automatic' | 'scrollableAxes' | 'always'; + /** + * Whether the content is clipped to the bounds of the scroll view. `false` lets a view of the + * content draw over the edges of the scroll view (an inset page, a view which goes under the safe area). + * + * @default true + * @nsProperty + */ + clipToBounds: boolean; + /** * iOS 26+ only. The scroll edge effect UIKit draws where content scrolls * under a bar, applied to every edge of the native scroll view. diff --git a/packages/core/ui/scroll-view/index.ios.ts b/packages/core/ui/scroll-view/index.ios.ts index ba2fc8c2f8..191a91df6d 100644 --- a/packages/core/ui/scroll-view/index.ios.ts +++ b/packages/core/ui/scroll-view/index.ios.ts @@ -1,5 +1,5 @@ import type { ScrollEventData } from './scroll-view-common'; -import { ScrollViewBase, scrollBarIndicatorVisibleProperty, isScrollEnabledProperty, iosContentInsetAdjustmentBehaviorProperty, iosScrollEdgeEffectProperty } from './scroll-view-common'; +import { ScrollViewBase, clipToBoundsProperty, scrollBarIndicatorVisibleProperty, isScrollEnabledProperty, iosContentInsetAdjustmentBehaviorProperty, iosScrollEdgeEffectProperty } from './scroll-view-common'; import { layout } from '../../utils'; import { SDK_VERSION } from '../../utils/constants'; import { View } from '../core/view'; @@ -84,8 +84,11 @@ export class ScrollView extends ScrollViewBase { if (!this.nativeViewProtected) { return; } - // Always set clipsToBounds for scroll-view - this.nativeViewProtected.clipsToBounds = true; + this.nativeViewProtected.clipsToBounds = this.clipToBounds; + } + + [clipToBoundsProperty.setNative](value: boolean) { + this._setNativeClipToBounds(); } protected attachNative() { diff --git a/packages/core/ui/scroll-view/scroll-view-common.ts b/packages/core/ui/scroll-view/scroll-view-common.ts index 17f2e5c871..4c63878df1 100644 --- a/packages/core/ui/scroll-view/scroll-view-common.ts +++ b/packages/core/ui/scroll-view/scroll-view-common.ts @@ -19,6 +19,7 @@ export abstract class ScrollViewBase extends ContentView { public isScrollEnabled: boolean; public iosContentInsetAdjustmentBehavior: 'never' | 'automatic' | 'scrollableAxes' | 'always'; public iosScrollEdgeEffect: CoreTypes.ScrollEdgeEffectType; + public clipToBounds: boolean; private _addedScrollEvent = false; @@ -129,6 +130,13 @@ export const isScrollEnabledProperty = new Property({ }); isScrollEnabledProperty.register(ScrollViewBase); +export const clipToBoundsProperty = new Property({ + name: 'clipToBounds', + defaultValue: true, + valueConverter: booleanConverter, +}); +clipToBoundsProperty.register(ScrollViewBase); + const insetAdjustmentConverter = makeParser<'never' | 'automatic' | 'scrollableAxes' | 'always'>(makeValidator('never', 'automatic', 'scrollableAxes', 'always')); export const iosContentInsetAdjustmentBehaviorProperty = new Property({ name: 'iosContentInsetAdjustmentBehavior',