Animated Streaming Markdown for React Native and Expo

Description:

Expo Animated Streaming Text is a React Native Markdown renderer distributed as an Expo source project.

Incoming words fade into place with a color trail, and a FlashList-based variant follows streaming replies while rendering blocks lazily.

Preview

Run the Demo

git clone https://github.com/rit3zh/expo-animated-streaming-text
cd expo-animated-streaming-text
bun install
bun run start --clear

Render an Incoming Reply

Use the renderer in src/components/streaming-text. Append incoming chunks to your accumulated Markdown string and pass it as children.

Keep streaming true during the response, then set it to false when the stream ends. For stored history, set animate={false} to render text immediately:

import { StreamingText } from "@/components/streaming-text";
type ReplyProps = {
  text: string;
  streaming: boolean;
};
export function Reply({ text, streaming }: ReplyProps) {
  return (
    <StreamingText streaming={streaming}>
      {text}
    </StreamingText>
  );
}

Follow Long Replies

Dragging detaches follow mode; scrolling near the bottom reattaches it. onRevealEnd fires after streaming ends and the final word finishes its reveal.

StreamingTextList accepts FlashList props except data, renderItem, and children. Give its parent a bounded height, such as a full-height screen:

import { View } from "react-native";
import { StreamingTextList } from "@/components/streaming-text";
export function ReplyScreen({ text, streaming }: { text: string; streaming: boolean }) {
  return (
    <View style={{ flex: 1 }}>
      <StreamingTextList
        streaming={streaming}
        contentContainerStyle={{ padding: 16 }}
        onRevealEnd={() => console.log("Reply revealed")}
      >
        {text}
      </StreamingTextList>
    </View>
  );
}

Animation and Scroll Options

PropDefaultBehavior
childrenRequiredAccumulated Markdown string
styleUnsetContainer styling
streamingfalseMore Markdown is arriving
animatetrueWord fade animation
wordMs16Minimum interval between words
fadeMs1500Fade duration per word
trailMs2000Color trail duration
trailColorsViolet-to-gray paletteCustom colors, or false to disable
onLinkPressOpens the browserCustom link handler receiving the URL

StreamingTextList Options

The list accepts the rendering options above and forwards its layout styles through FlashList.

PropDefaultBehavior
followtrueList-only automatic bottom following
followGlideMs200List-only scroll glide duration
followInsetUnsetList-only Reanimated DerivedValue<number> bottom inset
onRevealEndUnsetCallback after streaming ends and the reveal finishes

Markdown and Theme Configuration

The renderer accepts headings, emphasis, strikethrough, links, inline code, blockquotes, ordered lists, unordered lists, task lists, tables, rules, and fenced code blocks.

Use parseMarkdown(text, { streaming: true }) when consuming parsed blocks directly. Streaming mode closes unfinished syntax such as bold markers, inline-code markers, and link openings.

Edit src/constants/components/streaming-text.const.ts for light and dark palettes, timing, supported languages, and the vitesse-light and vitesse-dark Shiki themes.

Related Resources

Add Comment