Open History to see the last commit
1import {
2 IconAdjustmentsHorizontal,
3 IconAlertCircle,
4 IconAlertTriangle,
5 IconArchive,
6 IconArrowBackUp,
7 IconArrowDownCircle,
8 IconArrowRightCircle,
9 IconArrowUp,
10 IconArrowUpCircle,
11 IconArrowUpRight,
12 IconArrowUpRightCircle,
13 IconArrowsMaximize,
14 IconBellRinging,
15 IconBolt,
16 IconCamera,
17 IconCheck,
18 IconChevronDown,
19 IconCode,
20 IconChevronLeft,
21 IconChevronRight,
22 IconChevronUp,
23 IconCircleCheck,
24 IconCircleXFilled,
25 IconClock,
26 IconCopy,
27 IconDeviceDesktop,
28 IconDots,
29 IconDotsCircleHorizontal,
30 IconEdit,
31 IconExternalLink,
32 IconEye,
33 IconFileText,
34 IconFilter,
35 IconFolder,
36 IconFolderOpen,
37 IconFolderPlus,
38 IconGitBranch,
39 IconHammer,
40 IconGitMerge,
41 IconGitPullRequest,
42 IconInfoCircle,
43 IconKeyboard,
44 IconKeyboardHide,
45 IconLayoutColumns,
46 IconLayoutSidebar,
47 IconLetterSpacing,
48 IconLink,
49 IconMessage,
50 IconMinus,
51 IconNetwork,
52 IconPalette,
53 IconPin,
54 IconPinnedOff,
55 IconPlayerPlay,
56 IconPlayerStopFilled,
57 IconPlus,
58 IconQrcode,
59 IconRefresh,
60 IconSearch,
61 IconServer,
62 IconSettings,
63 IconSparkles,
64 IconLayoutSidebarRight,
65 IconTerminal2,
66 IconTextDecrease,
67 IconTextIncrease,
68 IconTool,
69 IconTrash,
70 IconTypography,
71 IconUserCircle,
72 IconWifiOff,
73 IconWorld,
74 IconX,
75 type Icon,
76} from "@tabler/icons-react-native";
77import { Platform } from "react-native";
78import { SymbolView as ExpoSymbolView, type SFSymbol, type SymbolViewProps } from "expo-symbols";
79
80const ANDROID_ICON_BY_SF_SYMBOL: Partial<Record<SFSymbol, Icon>> = {
81 "arrow.branch": IconGitBranch,
82 "arrow.clockwise": IconRefresh,
83 "arrow.down.circle": IconArrowDownCircle,
84 "arrow.right.circle": IconArrowRightCircle,
85 "arrow.triangle.branch": IconGitBranch,
86 "arrow.triangle.pull": IconGitPullRequest,
87 "arrow.turn.left.up": IconArrowBackUp,
88 "arrow.up": IconArrowUp,
89 "arrow.up.circle": IconArrowUpCircle,
90 "arrow.up.left.and.arrow.down.right": IconArrowsMaximize,
91 "arrow.up.right": IconArrowUpRight,
92 "arrow.up.right.circle": IconArrowUpRightCircle,
93 "arrow.uturn.backward": IconArrowBackUp,
94 archivebox: IconArchive,
95 "archivebox.fill": IconArchive,
96 "bell.badge": IconBellRinging,
97 "bolt.circle": IconBolt,
98 "bolt.horizontal.circle": IconBolt,
99 camera: IconCamera,
100 checkmark: IconCheck,
101 "checkmark.circle": IconCircleCheck,
102 clock: IconClock,
103 "chevron.down": IconChevronDown,
104 "chevron.left": IconChevronLeft,
105 "chevron.left.forwardslash.chevron.right": IconCode,
106 "chevron.right": IconChevronRight,
107 "chevron.up": IconChevronUp,
108 desktopcomputer: IconDeviceDesktop,
109 "doc.on.doc": IconCopy,
110 "doc.text": IconFileText,
111 ellipsis: IconDots,
112 "ellipsis.circle": IconDotsCircleHorizontal,
113 "exclamationmark.triangle": IconAlertTriangle,
114 eye: IconEye,
115 folder: IconFolder,
116 "folder.badge.plus": IconFolderPlus,
117 "folder.fill": IconFolder,
118 gearshape: IconSettings,
119 "info.circle": IconInfoCircle,
120 link: IconLink,
121 "line.3.horizontal.decrease.circle": IconFilter,
122 "line.3.horizontal.decrease.circle.fill": IconFilter,
123 magnifyingglass: IconSearch,
124 paintbrush: IconPalette,
125 "person.crop.circle": IconUserCircle,
126 pin: IconPin,
127 "pin.slash": IconPinnedOff,
128 play: IconPlayerPlay,
129 plus: IconPlus,
130 "qrcode.viewfinder": IconQrcode,
131 "point.3.connected.trianglepath.dotted": IconNetwork,
132 "point.topleft.down.curvedto.point.bottomright.up": IconGitMerge,
133 safari: IconExternalLink,
134 "server.rack": IconServer,
135 "sidebar.left": IconLayoutSidebar,
136 "sidebar.right": IconLayoutSidebarRight,
137 "slider.horizontal.3": IconAdjustmentsHorizontal,
138 "square.and.pencil": IconEdit,
139 "square.split.2x1": IconLayoutColumns,
140 "stop.fill": IconPlayerStopFilled,
141 terminal: IconTerminal2,
142 "text.bubble": IconMessage,
143 "text.word.spacing": IconLetterSpacing,
144 "textformat.size": IconTypography,
145 "textformat.size.larger": IconTextIncrease,
146 "textformat.size.smaller": IconTextDecrease,
147 trash: IconTrash,
148 "wifi.slash": IconWifiOff,
149 xmark: IconX,
150 "xmark.circle.fill": IconCircleXFilled,
151};
152
153// Callers can pass `{ ios, android }` names where `android` is a Material
154// icon name (the raw expo-symbols contract). Resolve those here too so the
155// android key keeps working through this wrapper — it wins over the SF map
156// when both match (e.g. folder vs folder_open for expanded project groups).
157const ANDROID_ICON_BY_MATERIAL_NAME: Record<string, Icon> = {
158 auto_awesome: IconSparkles,
159 bolt: IconBolt,
160 build: IconTool,
161 chat_bubble: IconMessage,
162 check: IconCheck,
163 close: IconX,
164 construction: IconHammer,
165 content_copy: IconCopy,
166 edit: IconEdit,
167 error: IconAlertCircle,
168 folder: IconFolder,
169 folder_open: IconFolderOpen,
170 keyboard: IconKeyboard,
171 keyboard_arrow_down: IconChevronDown,
172 keyboard_arrow_up: IconChevronUp,
173 keyboard_hide: IconKeyboardHide,
174 public: IconWorld,
175 remove: IconMinus,
176 terminal: IconTerminal2,
177 visibility: IconEye,
178};
179
180export type { SFSymbol } from "expo-symbols";
181export type AppSymbolName = SymbolViewProps["name"];
182
183export function SymbolView(props: SymbolViewProps) {
184 if (Platform.OS !== "android") {
185 return <ExpoSymbolView {...props} />;
186 }
187
188 const materialName = typeof props.name === "string" ? undefined : props.name.android;
189 const sfSymbol = typeof props.name === "string" ? props.name : props.name.ios;
190 const AndroidIcon =
191 (materialName ? ANDROID_ICON_BY_MATERIAL_NAME[materialName] : undefined) ??
192 (sfSymbol ? ANDROID_ICON_BY_SF_SYMBOL[sfSymbol] : undefined);
193
194 if (!AndroidIcon) {
195 return props.fallback ?? null;
196 }
197
198 return (
199 <AndroidIcon
200 accessibilityLabel={props.accessibilityLabel}
201 color={props.tintColor}
202 size={props.size}
203 strokeWidth={2}
204 style={props.style}
205 testID={props.testID}
206 />
207 );
208}