Open History to see the last commit
1import { requireOptionalNativeModule } from "expo";
2
3interface T3MarkdownTextSelectionNativeModule {
4 readonly setSelectionHandleColor?: (reactTag: number, color: number) => void;
5 readonly installCopySanitizer: (reactTag: number, contextClipboardConfig: string) => void;
6 readonly renderContextChip?: (payloadJson: string) => {
7 readonly uri: string;
8 readonly width: number;
9 readonly height: number;
10 /** Inline box height: the paragraph font's ascent, so the line box never grows. */
11 readonly boxHeight: number;
12 /** Bitmap top relative to the box top; negative when the chip overhangs the box. */
13 readonly offsetY: number;
14 } | null;
15}
16
17const nativeModule =
18 requireOptionalNativeModule<T3MarkdownTextSelectionNativeModule>("T3MarkdownTextSelection");
19
20export function installMarkdownCopySanitizer(reactTag: number, contextClipboardConfig = ""): void {
21 nativeModule?.installCopySanitizer(reactTag, contextClipboardConfig);
22}
23
24export function setMarkdownSelectionHandleColor(reactTag: number, color: number): void {
25 nativeModule?.setSelectionHandleColor?.(reactTag, color);
26}
27
28export function renderAndroidContextChip(payloadJson: string) {
29 return nativeModule?.renderContextChip?.(payloadJson) ?? null;
30}