---
title: "Streaming Response"
description: "A reply that streams in, then settles with actions."
documentation: "https://beui.dev/react-native/streaming-response"
markdown: "https://beui.dev/react-native/streaming-response.md"
---

# Streaming Response

> A reply that streams in, then settles with actions.

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 streaming-response
```

Or copy the source by hand and install its libraries:

```bash
npx expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-svg react-native-worklets
npm install uniwind tailwindcss
```

## Links

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

## README

### Streaming Response

Native port of [beUI Streaming Response](https://beui.dev/components/agents/streaming-response): an assistant reply that streams in and then offers actions.

```tsx
import * as Clipboard from "expo-clipboard";
import { StreamingResponse } from "./src";

<StreamingResponse
  status={done ? "complete" : "streaming"}
  onCopy={() => Clipboard.setStringAsync(text)}
  onRetry={retry}
  onFeedbackChange={(feedback) => rate(feedback)}
>
  {text}
</StreamingResponse>
```

#### Behavior

- Pass the text as it arrives, or your Markdown renderer's output. Plain strings, or an array of paragraphs, are styled for you; change their style with `textClassName`.
- Once `status` isn't `streaming`, the actions rise in beneath the reply: copy when you pass `onCopy`, retry when you pass `onRetry`, and helpful and not helpful once `complete` when you pass `onFeedbackChange`. Tapping the chosen rating again clears it.
- Copying swaps the icon to a check for 1600 ms. Copy with whatever clipboard library your app uses; the component doesn't depend on one.
- Control the rating with `feedback`, or leave it uncontrolled with `defaultFeedback`.

Pass `sources` to show a stack of favicons and a count beside the actions; tapping it folds open the source list from Citations.

#### Motion

The action row fades and rises 4 points over 220 ms. Buttons press to 0.9. Copying hands off cleanly: the copy icon slips down 3 points and fades in 110 ms, then the check draws itself on, left to right, over 260 ms. The two never overlap, and nothing is scaled, so the icons stay sharp throughout.

#### Better on a phone

Reply text is selectable, so a long press brings up the system menu to copy a sentence or look up a word, not just the whole reply.

#### Accessibility

- The reply is a polite live region on Android while streaming. Set `announce={false}` inside a conversation that's already announced, such as `MessageScroller`.
- It's marked busy while streaming.
- Ratings report whether they're selected.
- Reduced motion, or `disableAnimation`, fades the actions in place.

Copy this directory, `components/citations/`, `hooks/use-presence.ts`, `hooks/use-reduced-motion.ts`, `primitives/agent-icons.tsx`, `primitives/disclosure.tsx`, `primitives/rise-in.tsx`, `primitives/overlay.tsx`, `styles/motion.ts`, and the semantic tokens in `styles/theme.css`. It uses `react-native-svg` for its icons. Its overlay uses `FullWindowOverlay` from `react-native-screens` on iOS, so it covers native tab bars.
