Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

T3MarkdownTextSelectionModule.ts

25 lines1012 Bytes

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