Expo UI and Router for iOSExpo SDK 57 and later, iOS only
Modifiers

gridCellAnchor

Specifies a custom alignment anchor for a view that acts as a grid cell.

gridCellAnchor(anchor)

iOS 16+
ParameterTypeDescription
anchor{ anchor: 'center' | 'top' | 'bottom' | 'leading' | 'trailing' | 'topLeading' | 'topTrailing' | 'bottomLeading' | 'bottomTrailing' | 'zero', type: 'preset' } | { points: { x: number, y: number }, type: 'custom' }The unit point that defines how to align the view within the bounds of its grid cell.

Specifies a custom alignment anchor for a view that acts as a grid cell.

Returns: ModifierConfig

A view that uses the specified anchor point to align its content.

Example

// Using a preset anchor
<Rectangle
  modifiers={[
    gridCellAnchor({ type: 'preset', anchor: 'center' }),
  ]}
/>

// Using a custom anchor point
<Rectangle
  modifiers={[
    gridCellAnchor({ type: 'custom', points: { x: 0.3, y: 0.8 } }),
  ]}
/>

Works with

Works only in some places

Works only on a cell of a Grid. Grid is in @expo/ui/swift-ui, but it has no Expo docs page.

You can add it to any of these components, but it does something only in the place above.

Sources

The original Expo docs for this page:

On this page