Modifiers
defaultScrollAnchorForRole
Sets the default anchor point for a scroll view for a specific role. Pass null to opt out of a specific role while keeping anchors for other roles.
defaultScrollAnchorForRole(anchor, role)
iOS 18+
| Parameter | Type | Description |
|---|---|---|
anchor | UnitPointValue | null | The anchor point, or null to opt out of this role. |
role | 'initialOffset' | 'sizeChanges' | 'alignment' | The scroll anchor role: 'initialOffset', 'sizeChanges', or 'alignment'. |
Sets the default anchor point for a scroll view for a specific role. Pass null to opt out of a specific role while keeping anchors for other roles.
Returns: ModifierConfig
See: Official SwiftUI documentation.
Works with
Sources
The original Expo docs for this page:
- defaultScrollAnchorForRole (Modifiers) (
source-of-truth/versions/v57.0.0/sdk/ui/swift-ui/modifiers.md)