Command palette

@yasinsensoy/native

React Native · Components

Markdown

Renders Markdown text safely; designed for streaming text like AI responses.

2 exports

Live example

The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.

Preview

Code

import { Markdown } from "@yasinsensoy/native";

<Markdown streaming={durum === "streaming"}>{metin}</Markdown>

Events

  1. Events appear here when you interact with the preview.

Import

import { Markdown } from "@yasinsensoy/native";

Markdown

component

Renders Markdown text safely; designed for streaming text like AI responses. The same parser as Markdown on web (@yasinsensoy/core) and the same typography as RichTextView.

  • Streaming friendly: Text is split into top-level blocks; unchanged blocks are not re-parsed or re-rendered. Each new chunk updates only the last block.
  • No flicker: While streaming, an unclosed **bold, a half link [text](htt, a lone # or - is completed/hidden temporarily. A blinking cursor is drawn at the end.
  • GFM: Headings, lists (nested, numbered, task lists), quotes, code blocks (CodeBlock), tables (alignment, horizontal scroll), links, bare URLs, ~~strikethrough~~.
  • Safe: HTML is not executed, no WebView; unsafe addresses like javascript: are dropped.
Markdown({ children, streaming, onLinkPress, onMentionPress, codeLineNumbers, fontSize, empty, style, testID, }: MarkdownProps): JSX.Element

Examples

<Markdown>{response}</Markdown>
<Markdown streaming={status === "streaming"}>{message.content}</Markdown>

MarkdownProps

interface

Props of the Markdown component.

NameTypeDefaultDescription
childrenstring | null | undefinedMarkdown text to show. While streaming the new text is given on every chunk.
streaming?booleanfalseIs text still arriving (while an AI response streams)? While true the last block is completed temporarily (an unclosed **, a half link or a lone # do not show on screen) and a blinking cursor is drawn at the end.
onLinkPress?(url: string) => voidCalled when a link is pressed. If omitted a safe address opens in the system.
onMentionPress?(mention: RichTextMention) => voidCalled when a mention ([@Name](mention:id)) is pressed. The counterpart of mentionHref on web.
codeLineNumbers?booleanfalseLine numbers in code blocks.
fontSize?number15Body font size (pixels; scales with the device).
empty?ReactNodeElement shown when the text is empty.
style?StyleProp<ViewStyle>Container style.
testID?stringTest id.