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

markdownFileIcons.ts

17 lines703 Bytes

1import { Image, type ImageSourcePropType } from "react-native";
2​
3import type { MarkdownFileIcon } from "./markdownLinks";
4import { MARKDOWN_FILE_ICON_SOURCES } from "./markdownFileIcons.generated";
5​
6export function markdownFileIconSource(icon: MarkdownFileIcon): ImageSourcePropType {
7 return MARKDOWN_FILE_ICON_SOURCES[icon];
8}
9​
10/**
11 * Bundled icon URI handed to native views that draw the icon themselves. The
12 * sources are static requires, so this only comes back undefined when the
13 * bundler dropped the asset; callers treat a missing icon as "no icon".
14 */
15export function markdownIconAssetUri(source: ImageSourcePropType): string | undefined {
16 return Image.resolveAssetSource(source)?.uri;