SwipeUI

iOS Native Modal

A themed screen and typed presentation options for a system iOS modal.

npx @swipeui/cli add modal-presets
Variant
Preset
Material
Scheme
Feel
Real free component with a browser animation bridge. Native motion, haptics and materials need a device.

When to use it

  • Opening screens as native modals, page sheets, form sheets with detents, or full-screen modals.
  • Matching modal backgrounds to your theme in light and dark.
  • Using Expo Router or React Navigation's native stack with consistent presentation options.

When not to use it

  • Overlays inside a screen. Use Sheet, Dialog or Popover.
  • JavaScript-only stacks; these are native-stack options.

Installation

Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.

npx @swipeui/cli add modal-presets
  • Adds components/swipeui/overlay/modal-presets.ts, components/swipeui/overlay/native-modal-content.tsx and 5 shared helpers.
  • Installs uniwind, react-native-safe-area-context, react-native-reanimated, react-native-worklets, react-native-gesture-handler, clsx, tailwind-merge, class-variance-authority. In Expo apps it uses npx expo install so versions match your SDK.

Usage

import { Stack } from 'expo-router';
import { useModalPresets } from '@/components/swipeui/overlay/modal-presets';
import { NativeModalContent } from '@/components/swipeui/overlay/native-modal-content';

export function EditRouteScreen() {
  const { pageSheet } = useModalPresets();
  return (
    <>
      <Stack.Screen options={{ ...pageSheet, headerShown: false }} />
      <NativeModalContent title="Edit route">
        <RouteForm />
      </NativeModalContent>
    </>
  );
}

Use leadingAction and trailingAction for Cancel and Done when the screen needs them. NativeModalContent places child overlays in the screen's own scope.

API reference

PropTypeDefaultDescription
title?string—

Visible and spoken name of the route.

leadingAction?ReactNode—

Optional leading action, such as Cancel.

trailingAction?ReactNode—

Optional trailing action, such as Done.

childrenReactNode—

Form or other screen content.

testID?string—

Root test identifier.

See iOS modals for provider setup and native-stack options in both routers.

For a single-field route, omit the title and action slots. The showcase uses InlineEdit for the route name. onSaveComplete reports a successful edit and onCancelEdit reports a discarded draft after the editor starts its closing morph.

Behavior and gestures

  • Modals and sheets behave exactly like the system's, including swipe down to dismiss.
  • Form sheets can rest at fractional heights you choose; Android supports up to three.
  • On iOS, form sheets show a grabber.

Accessibility

  • Accessibility comes from the native presentation.
  • Backgrounds use your theme tokens, so contrast follows your preset.
  • Register OverlayScope inside native modals so SwipeUI overlays appear above them.

Motion

  • Static on its own; any movement comes from the parent that animates it.
  • System motion only.

Performance

  • The modal body scrolls within the screen presentation.

Notes for AI

  • Spread presets.formSheet (or modal, pageSheet, fullScreen) into a screen's options.
  • pageSheet uses native-stack modal under the hood.

Compatibility

Runs onSupported
Expo SDK 57Yes
Expo SDK 58Yes
React Native CLI (with Expo modules)Yes
Expo GoYes
iOSYes
AndroidYes

This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.

Related items