fix(app): native iOS text selection in assistant messages via UITextView

Fixes #238
Fixes #648
Refs #21
This commit is contained in:
Li Mu Zhi
2026-05-27 04:55:46 +00:00
committed by GitHub
parent 1908ab8765
commit 8aa1530be1
8 changed files with 134 additions and 16 deletions
+2 -13
View File
@@ -10,6 +10,7 @@ import {
ViewStyle,
type TextStyle,
} from "react-native";
import { MarkdownParagraphView, MarkdownTextSpan } from "@/components/markdown-text";
import * as React from "react";
import {
useState,
@@ -1527,7 +1528,7 @@ function MarkdownInheritedText({
() => [inheritedStyles, textStyle, overrideStyle],
[inheritedStyles, textStyle, overrideStyle],
);
return <Text style={style}>{children}</Text>;
return <MarkdownTextSpan style={style}>{children}</MarkdownTextSpan>;
}
interface MarkdownListItemContentProps {
@@ -1542,18 +1543,6 @@ function MarkdownListItemContent({ contentStyle, children }: MarkdownListItemCon
return <View style={style}>{children}</View>;
}
interface MarkdownParagraphViewProps {
paragraphStyle: ViewStyle;
children: ReactNode;
}
const MARKDOWN_PARAGRAPH_RESET: ViewStyle = { marginBottom: 0 };
function MarkdownParagraphView({ paragraphStyle, children }: MarkdownParagraphViewProps) {
const style = useMemo(() => [paragraphStyle, MARKDOWN_PARAGRAPH_RESET], [paragraphStyle]);
return <View style={style}>{children}</View>;
}
interface MarkdownListViewProps {
baseStyle: ViewStyle;
spacing: { marginTop: number; marginBottom: number };