Enable Markdown Support in SwiftUI Text Component
Mark Witt
### Summary
The
Text
component in @expo/ui
currently doesn't support markdown rendering, even though SwiftUI's native Text
view supports it out of the box (iOS 15+). It would be great to enable this feature to allow styled text without needing external markdown libraries.### Current Behavior
The
Text
component renders markdown syntax as plain text:<Text>This is
bold
and italic
</Text>// Renders: "This is
bold
and italic
" (literal asterisks)### Desired BehaviorThe
Text
component should render markdown formatting:<Text>This is
bold
and italic
</Text>// Renders: "This is bold and italic" (with formatting applied)### Technical Details
The issue is in
ios/TextView.swift
(line 49):// Current implementation
Text(props.text)SwiftUI's
Text
only parses markdown when initialized with a LocalizedStringKey
. To enable markdown support, the implementation needs to be:// Proposed implementation
Text(LocalizedStringKey(props.text))### Proposed API
Option 1: Always enable markdown (breaking change)
<Text>This is
bold
</Text>Option 2: Add opt-in prop (backward compatible)
<Text markdown>This is
bold
</Text>// or
<Text enableMarkdown>This is
bold
</Text>### Use CaseThis would enable rich text content without external dependencies.