Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/core/ui/core/view-base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
6 changes: 5 additions & 1 deletion packages/core/ui/scroll-view/index.android.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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();
}
Expand Down
9 changes: 9 additions & 0 deletions packages/core/ui/scroll-view/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 6 additions & 3 deletions packages/core/ui/scroll-view/index.ios.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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() {
Expand Down
8 changes: 8 additions & 0 deletions packages/core/ui/scroll-view/scroll-view-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -129,6 +130,13 @@ export const isScrollEnabledProperty = new Property<ScrollViewBase, boolean>({
});
isScrollEnabledProperty.register(ScrollViewBase);

export const clipToBoundsProperty = new Property<ScrollViewBase, boolean>({
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<ScrollViewBase, 'never' | 'automatic' | 'scrollableAxes' | 'always'>({
name: 'iosContentInsetAdjustmentBehavior',
Expand Down
Loading