Expo UI and Router for iOS
Components

VStack

A SwiftUI VStack component for vertical layouts. Also called Column (Universal).

Expo UI VStack matches the official SwiftUI VStack API and arranges its children vertically.

Usage

Basic vertical stack

import { Host, VStack, Text } from '@expo/ui/swift-ui';

export default function BasicVStackExample() {
  // Give the host a size when the stack needs room to align its children.
  return (
    <Host style={{ flex: 1 }}>
      <VStack spacing={12}>
        <Text>First</Text>
        <Text>Second</Text>
        <Text>Third</Text>
      </VStack>
    </Host>
  );
}

With alignment

The alignment prop controls horizontal alignment of children. Available options are: leading, center, and trailing.

import { Host, VStack, Rectangle } from '@expo/ui/swift-ui';
import { frame } from '@expo/ui/swift-ui/modifiers';

export default function VStackAlignmentExample() {
  return (
    <Host style={{ flex: 1 }}>
      <VStack spacing={12} alignment="leading">
        <Rectangle modifiers={[frame({ width: 50, height: 50 })]} />
        <Rectangle
          modifiers={[frame({ width: 100, height: 50 })]}
        />
        <Rectangle modifiers={[frame({ width: 75, height: 50 })]} />
      </VStack>
    </Host>
  );
}

API

import { VStack } from '@expo/ui/swift-ui';

Component

VStack

Type: React.Element<VStackProps>

VStackProps

alignment

Optional • Literal type: string

The horizontal alignment of children within the stack.

Acceptable values are: 'center' | 'leading' | 'trailing'

children

Type: ReactNode

spacing

Optional • Type: number

The spacing between children.

Inherited props

Modifiers

Use these modifiers in the modifiers prop of the SwiftUI and Universal version.

Modifiers for VStack

Modifiers for any view

Sources

The original Expo docs for this page:

On this page