---
title: "Image Generation"
description: "A dot field you can steer while the image forms."
documentation: "https://beui.dev/react-native/image-generation"
markdown: "https://beui.dev/react-native/image-generation.md"
---

# Image Generation

> A dot field you can steer while the image forms.

React Native component for Expo, from beUI Native. Group: AI agents. Variants: 1.

## Install

Set up beUI Native once per app first: https://beui.dev/docs/native-setup.md

```bash
npx beui-native add image-generation
```

Or copy the source by hand and install its libraries:

```bash
npx expo install @shopify/react-native-skia react-native-gesture-handler react-native-reanimated react-native-svg react-native-worklets
npm install uniwind tailwindcss
```

## Links

- Source: https://github.com/starc007/beui-native/tree/main/src/components/image-generation
- Registry JSON with every file: https://beui.dev/native/r/image-generation
- Open in Expo Go: exp://u.expo.dev/93a3a95c-6dc2-4adb-b57c-efbecf859f25/--/image-generation?runtime-version=exposdk%3A58.0.0&channel-name=production
- Web version: https://beui.dev/components/agents/image-generation.md

## README

### Image Generation

Native port of [beUI Image Generation](https://beui.dev/components/agents/image-generation): an image coming into being.

```tsx
import { Image } from "react-native";
import { ImageGeneration } from "./src";

<ImageGeneration status={status} prompt="a quiet mountain landscape at sunset">
  <Image source={{ uri }} style={{ width: "100%", height: "100%" }} />
</ImageGeneration>
```

#### Behavior

- `status` moves through `queued`, `generating`, `refining` and `complete`, or `error`. You drive it.
- While active, a lattice of dots fills the frame, drawn with Skia. A soft lens wanders across it: dots inside grow, brighten and push outward.
- At `refining` the finished media shows through at 62% under the fading dots. At `complete` it settles into full view and the dots dissolve. The media stays mounted throughout, so nothing shifts.
- The frame reserves `aspectRatio` (1 by default). `size="compact"` caps it at 208 points wide; `"fluid"` fills.
- The status rolls along underneath with a turning glyph, and the `prompt` sits under it in quotes. After an error, `onRetry` adds "Try again".

#### Better on a phone

- The web version's lens follows a mouse pointer and is switched off for touch. Here it follows your finger: drag across the placeholder and the lens tracks you, swelling under your touch, then wanders off again when you let go. Turn it off with `interactive={false}`.
- `onLongPress` on the finished image lifts it slightly before firing, ready for a save or share sheet.
- The lens eases at the same speed on 60 Hz and 120 Hz screens.

#### Accessibility

- The frame is an image named by `label`, or the status and prompt. The status line is a polite live region, and the frame is marked busy while active.
- Reduced motion, or `disableAnimation`, draws one still frame of dots with the lens centered, and swaps statuses without movement.

Copy this directory, `hooks/use-presence.ts`, `hooks/use-reduced-motion.ts`, `primitives/agent-icons.tsx`, `primitives/roll-text.tsx`, `styles/motion.ts`, and the semantic tokens in `styles/theme.css`. It uses `@shopify/react-native-skia`, `react-native-svg` and Gesture Handler.
