Magic Modallatest

Introduction

Build imperative, awaitable, type-safe modal flows in React Native.

React Native Magic Modal turns a modal interaction into a value you can await. Mount one portal near the app root. Call show() from anywhere.

const result = await magicModal.show<ConfirmationResult>(() => (
  <ConfirmationModal />
)).promise;

if (
  result.reason === MagicModalHideReason.INTENTIONAL_HIDE &&
  result.data.confirmed
) {
  completePurchase();
}

Why use it?

The mental model

  1. MagicModalPortal owns the modal stack. Mount it once.
  2. magicModal.show pushes content from anywhere and returns a promise.
  3. useMagicModal closes the current modal with typed data.

Designed for application modals

For a scroll-heavy bottom sheet with snap points, use a dedicated bottom-sheet library. Use Magic Modal for discrete interactions and async decisions.

Next step

Install the package and its peers. Mount the portal in your app root.

On this page