React

Getting Started

Guide to configuring Stackflow plugin for using Crispy AppScreen.

Overview

To use the AppScreen component of Crispy React, add seedPlugin to the Stackflow plugin.

App Screen

Learn more about the AppScreen component.

seedPlugin provides the following features:

  • Theme Context Provision: Automatically passes theme to all AppScreen components.
  • Global Interaction Management: Manages Swipe Back gesture and global transition state.

Installation

seedPlugin is included in the @seed-design/stackflow package.

npm install @seed-design/stackflow

Usage

Add seedPlugin to the plugins array when configuring Stackflow.

import { stackflow } from "@stackflow/react/future";
import { seedPlugin } from "@seed-design/stackflow";

export const { Stack, actions } = stackflow({
  plugins: [
    seedPlugin({ theme: "cupertino" }),
    // ...
  ],
  // ...
});

Options

Prop

Type

theme"android" | "cupertino"

Dynamic Options

When the theme needs to be determined dynamically in SSR environments or similar cases, you can set seedPlugin options through initialContext provided to Stack.

stackflow.ts
import { stackflow } from "@stackflow/react/future";
import { seedPlugin } from "@seed-design/stackflow";

export const { Stack, actions } = stackflow({
  plugins: [
    seedPlugin(({ initialContext }) => ({
      theme: initialContext?.theme ?? "cupertino",
    })),
    // ...
  ],
  // ...
});

Pass the theme with initialContext when rendering <Stack>.

App.tsx
import type { SeedPluginOptions } from "@seed-design/stackflow";

<Stack initialContext={{ theme } satisfies SeedPluginOptions} />;

What It Provides

Theme Context

seedPlugin passes the theme configured through the theme option to all AppScreen components. All AppScreen uses this theme by default.

Like @stackflow/plugin-basic-ui, theme can be either "android" or "cupertino".

// The theme provided as an option to seedPlugin is applied by default to `AppScreen`.
// You can override it through the `theme` prop of `AppScreen`.
<AppScreen>
  <AppBar>{/* ... */}</AppBar>
  <AppScreenContent>{/* ... */}</AppScreenContent>
</AppScreen>

Swipe Back Gesture

When using theme="cupertino", iOS-style Swipe Back gesture is activated.

  • Swiping from the left edge of the screen to the right moves to the previous Activity.
  • The AppScreen position is updated based on the swiping amount.

Table of contents