Open History to see the last commit
1import type { Icon } from "@tabler/icons-react-native/types";
2/* Package-root imports eagerly register the entire Tabler icon set in Metro. */
3import IconAdjustmentsHorizontal from "@tabler/icons-react-native/IconAdjustmentsHorizontal";
4import IconAlignLeft from "@tabler/icons-react-native/IconAlignLeft";
5import IconAlertCircle from "@tabler/icons-react-native/IconAlertCircle";
6import IconAlertTriangle from "@tabler/icons-react-native/IconAlertTriangle";
7import IconApps from "@tabler/icons-react-native/IconApps";
8import IconArchive from "@tabler/icons-react-native/IconArchive";
9import IconCalendarClock from "@tabler/icons-react-native/IconCalendarClock";
10import IconArrowBackUp from "@tabler/icons-react-native/IconArrowBackUp";
11import IconArrowDown from "@tabler/icons-react-native/IconArrowDown";
12import IconArrowForwardUp from "@tabler/icons-react-native/IconArrowForwardUp";
13import IconArrowLeft from "@tabler/icons-react-native/IconArrowLeft";
14import IconArrowRight from "@tabler/icons-react-native/IconArrowRight";
15import IconArrowDownCircle from "@tabler/icons-react-native/IconArrowDownCircle";
16import IconArrowRightCircle from "@tabler/icons-react-native/IconArrowRightCircle";
17import IconArrowUp from "@tabler/icons-react-native/IconArrowUp";
18import IconArrowUpCircle from "@tabler/icons-react-native/IconArrowUpCircle";
19import IconArrowUpRight from "@tabler/icons-react-native/IconArrowUpRight";
20import IconArrowUpRightCircle from "@tabler/icons-react-native/IconArrowUpRightCircle";
21import IconArrowsLeftRight from "@tabler/icons-react-native/IconArrowsLeftRight";
22import IconArrowsDiagonal2 from "@tabler/icons-react-native/IconArrowsDiagonal2";
23import IconArrowsMinimize from "@tabler/icons-react-native/IconArrowsMinimize";
24import IconBan from "@tabler/icons-react-native/IconBan";
25import IconBellRinging from "@tabler/icons-react-native/IconBellRinging";
26import IconBolt from "@tabler/icons-react-native/IconBolt";
27import IconBox from "@tabler/icons-react-native/IconBox";
28import IconBrain from "@tabler/icons-react-native/IconBrain";
29import IconCamera from "@tabler/icons-react-native/IconCamera";
30import IconCar from "@tabler/icons-react-native/IconCar";
31import IconChartBar from "@tabler/icons-react-native/IconChartBar";
32import IconCheck from "@tabler/icons-react-native/IconCheck";
33import IconCloud from "@tabler/icons-react-native/IconCloud";
34import IconChevronDown from "@tabler/icons-react-native/IconChevronDown";
35import IconChevronLeft from "@tabler/icons-react-native/IconChevronLeft";
36import IconChevronRight from "@tabler/icons-react-native/IconChevronRight";
37import IconChevronUp from "@tabler/icons-react-native/IconChevronUp";
38import IconCircle from "@tabler/icons-react-native/IconCircle";
39import IconCircleFilled from "@tabler/icons-react-native/IconCircleFilled";
40import IconCircleCheck from "@tabler/icons-react-native/IconCircleCheck";
41import IconCircleDashed from "@tabler/icons-react-native/IconCircleDashed";
42import IconCircleDot from "@tabler/icons-react-native/IconCircleDot";
43import IconCircleXFilled from "@tabler/icons-react-native/IconCircleXFilled";
44import IconMoodPlus from "@tabler/icons-react-native/IconMoodPlus";
45import IconTag from "@tabler/icons-react-native/IconTag";
46import IconTicket from "@tabler/icons-react-native/IconTicket";
47import IconClock from "@tabler/icons-react-native/IconClock";
48import IconClipboard from "@tabler/icons-react-native/IconClipboard";
49import IconCode from "@tabler/icons-react-native/IconCode";
50import IconCopy from "@tabler/icons-react-native/IconCopy";
51import IconDatabase from "@tabler/icons-react-native/IconDatabase";
52import IconDeviceDesktop from "@tabler/icons-react-native/IconDeviceDesktop";
53import IconDeviceLaptop from "@tabler/icons-react-native/IconDeviceLaptop";
54import IconDeviceMobile from "@tabler/icons-react-native/IconDeviceMobile";
55import IconDots from "@tabler/icons-react-native/IconDots";
56import IconPlusMinus from "@tabler/icons-react-native/IconPlusMinus";
57import IconDotsVertical from "@tabler/icons-react-native/IconDotsVertical";
58import IconDotsCircleHorizontal from "@tabler/icons-react-native/IconDotsCircleHorizontal";
59import IconEdit from "@tabler/icons-react-native/IconEdit";
60import IconExternalLink from "@tabler/icons-react-native/IconExternalLink";
61import IconEyeOff from "@tabler/icons-react-native/IconEyeOff";
62import IconEye from "@tabler/icons-react-native/IconEye";
63import IconFileText from "@tabler/icons-react-native/IconFileText";
64import IconFileDiff from "@tabler/icons-react-native/IconFileDiff";
65import IconFilter from "@tabler/icons-react-native/IconFilter";
66import IconFilterFilled from "@tabler/icons-react-native/IconFilterFilled";
67import IconFlask from "@tabler/icons-react-native/IconFlask";
68import IconFolder from "@tabler/icons-react-native/IconFolder";
69import IconFolderOpen from "@tabler/icons-react-native/IconFolderOpen";
70import IconHeadphones from "@tabler/icons-react-native/IconHeadphones";
71import IconFolderPlus from "@tabler/icons-react-native/IconFolderPlus";
72import IconGitPullRequestClosed from "@tabler/icons-react-native/IconGitPullRequestClosed";
73import IconGitPullRequestDraft from "@tabler/icons-react-native/IconGitPullRequestDraft";
74import IconGitCommit from "@tabler/icons-react-native/IconGitCommit";
75import IconGitBranch from "@tabler/icons-react-native/IconGitBranch";
76import IconGitMerge from "@tabler/icons-react-native/IconGitMerge";
77import IconGitPullRequest from "@tabler/icons-react-native/IconGitPullRequest";
78import IconHammer from "@tabler/icons-react-native/IconHammer";
79import IconHome from "@tabler/icons-react-native/IconHome";
80import IconInfoCircle from "@tabler/icons-react-native/IconInfoCircle";
81import IconKeyboard from "@tabler/icons-react-native/IconKeyboard";
82import IconKeyboardHide from "@tabler/icons-react-native/IconKeyboardHide";
83import IconLock from "@tabler/icons-react-native/IconLock";
84import IconLayoutColumns from "@tabler/icons-react-native/IconLayoutColumns";
85import IconLayoutSidebar from "@tabler/icons-react-native/IconLayoutSidebar";
86import IconLayoutSidebarRight from "@tabler/icons-react-native/IconLayoutSidebarRight";
87import IconLetterSpacing from "@tabler/icons-react-native/IconLetterSpacing";
88import IconMicrophone from "@tabler/icons-react-native/IconMicrophone";
89import IconLink from "@tabler/icons-react-native/IconLink";
90import IconListNumbers from "@tabler/icons-react-native/IconListNumbers";
91import IconMenu2 from "@tabler/icons-react-native/IconMenu2";
92import IconMessageCircleQuestion from "@tabler/icons-react-native/IconMessageCircleQuestion";
93import IconMessage from "@tabler/icons-react-native/IconMessage";
94import IconMail from "@tabler/icons-react-native/IconMail";
95import IconMessageDots from "@tabler/icons-react-native/IconMessageDots";
96import IconMessagePlus from "@tabler/icons-react-native/IconMessagePlus";
97import IconMinus from "@tabler/icons-react-native/IconMinus";
98import IconMoon from "@tabler/icons-react-native/IconMoon";
99import IconNetwork from "@tabler/icons-react-native/IconNetwork";
100import IconPalette from "@tabler/icons-react-native/IconPalette";
101import IconPencil from "@tabler/icons-react-native/IconPencil";
102import IconPlug from "@tabler/icons-react-native/IconPlug";
103import IconPhoto from "@tabler/icons-react-native/IconPhoto";
104import IconPin from "@tabler/icons-react-native/IconPin";
105import IconPinnedOff from "@tabler/icons-react-native/IconPinnedOff";
106import IconPlayerPause from "@tabler/icons-react-native/IconPlayerPause";
107import IconPlayerPlay from "@tabler/icons-react-native/IconPlayerPlay";
108import IconPlayerStopFilled from "@tabler/icons-react-native/IconPlayerStopFilled";
109import IconPlus from "@tabler/icons-react-native/IconPlus";
110import IconQrcode from "@tabler/icons-react-native/IconQrcode";
111import IconRefresh from "@tabler/icons-react-native/IconRefresh";
112import IconRobot from "@tabler/icons-react-native/IconRobot";
113import IconSearch from "@tabler/icons-react-native/IconSearch";
114import IconShare from "@tabler/icons-react-native/IconShare";
115import IconServer from "@tabler/icons-react-native/IconServer";
116import IconSettings from "@tabler/icons-react-native/IconSettings";
117import IconStack2 from "@tabler/icons-react-native/IconStack2";
118import IconStar from "@tabler/icons-react-native/IconStar";
119import IconStarFilled from "@tabler/icons-react-native/IconStarFilled";
120import IconStethoscope from "@tabler/icons-react-native/IconStethoscope";
121import IconSun from "@tabler/icons-react-native/IconSun";
122import IconShieldQuestion from "@tabler/icons-react-native/IconShieldQuestion";
123import IconTarget from "@tabler/icons-react-native/IconTarget";
124import IconTerminal2 from "@tabler/icons-react-native/IconTerminal2";
125import IconTextDecrease from "@tabler/icons-react-native/IconTextDecrease";
126import IconTextIncrease from "@tabler/icons-react-native/IconTextIncrease";
127import IconTool from "@tabler/icons-react-native/IconTool";
128import IconTrash from "@tabler/icons-react-native/IconTrash";
129import IconTypography from "@tabler/icons-react-native/IconTypography";
130import IconDownload from "@tabler/icons-react-native/IconDownload";
131import IconSitemap from "@tabler/icons-react-native/IconSitemap";
132import IconUpload from "@tabler/icons-react-native/IconUpload";
133import IconUserCircle from "@tabler/icons-react-native/IconUserCircle";
134import IconUserCheck from "@tabler/icons-react-native/IconUserCheck";
135import IconUserX from "@tabler/icons-react-native/IconUserX";
136import IconUserQuestion from "@tabler/icons-react-native/IconUserQuestion";
137import IconUserPlus from "@tabler/icons-react-native/IconUserPlus";
138import IconUsers from "@tabler/icons-react-native/IconUsers";
139import IconWifi from "@tabler/icons-react-native/IconWifi";
140import IconWifiOff from "@tabler/icons-react-native/IconWifiOff";
141import IconWorld from "@tabler/icons-react-native/IconWorld";
142import IconX from "@tabler/icons-react-native/IconX";
143import type { AndroidSymbol, SFSymbol, SymbolViewProps } from "expo-symbols";
144import { StyleSheet, View } from "react-native";
145import { withUniwind } from "uniwind";
146
147const ANDROID_ICON_BY_SF_SYMBOL = {
148 plusminus: IconPlusMinus,
149 "git.pull-request.closed": IconGitPullRequestClosed,
150 "git.pull-request.draft": IconGitPullRequestDraft,
151 "git.commit": IconGitCommit,
152 "arrow.branch": IconGitBranch,
153 "arrow.left": IconArrowLeft,
154 "arrow.right": IconArrowRight,
155 "arrow.left.arrow.right": IconArrowsLeftRight,
156 "arrow.clockwise": IconRefresh,
157 "arrow.down": IconArrowDown,
158 "arrow.down.circle": IconArrowDownCircle,
159 "arrow.right.circle": IconArrowRightCircle,
160 "arrow.triangle.branch": IconGitBranch,
161 "arrow.triangle.merge": IconGitMerge,
162 "arrow.triangle.pull": IconGitPullRequest,
163 "square.3.layers.3d": IconStack2,
164 "arrow.turn.left.up": IconArrowBackUp,
165 "arrow.up": IconArrowUp,
166 "arrow.up.circle": IconArrowUpCircle,
167 "arrow.up.left.and.arrow.down.right": IconArrowsDiagonal2,
168 "arrow.down.right.and.arrow.up.left": IconArrowsMinimize,
169 "arrow.up.right": IconArrowUpRight,
170 "arrow.up.right.circle": IconArrowUpRightCircle,
171 "arrow.uturn.backward": IconArrowBackUp,
172 "arrow.uturn.forward": IconArrowForwardUp,
173 archivebox: IconArchive,
174 "archivebox.fill": IconArchive,
175 "bell.badge": IconBellRinging,
176 "bolt.circle": IconBolt,
177 "bolt.horizontal.circle": IconBolt,
178 brain: IconBrain,
179 "cable.connector": IconPlug,
180 camera: IconCamera,
181 car: IconCar,
182 "chart.bar.xaxis": IconChartBar,
183 checkmark: IconCheck,
184 "checkmark.circle": IconCircleCheck,
185 "checkmark.circle.fill": IconCircleCheck,
186 circle: IconCircle,
187 "circle.fill": IconCircleFilled,
188 "circle.dashed": IconCircleDashed,
189 "circle.inset.filled": IconCircleDot,
190 "circle.dashed.inset.filled": IconCircleDot,
191 "calendar.badge.clock": IconCalendarClock,
192 clock: IconClock,
193 timer: IconClock,
194 "face.smiling": IconMoodPlus,
195 tag: IconTag,
196 ticket: IconTicket,
197 cloud: IconCloud,
198 cube: IconBox,
199 "chevron.down": IconChevronDown,
200 "chevron.left": IconChevronLeft,
201 "chevron.left.forwardslash.chevron.right": IconCode,
202 "chevron.right": IconChevronRight,
203 "chevron.up": IconChevronUp,
204 desktopcomputer: IconDeviceDesktop,
205 doc: IconFileText,
206 "doc.on.doc": IconCopy,
207 "doc.text": IconFileText,
208 "file.diff": IconFileDiff,
209 ellipsis: IconDots,
210 moon: IconMoon,
211 "ellipsis.circle": IconDotsCircleHorizontal,
212 "envelope.badge": IconMail,
213 "exclamationmark.triangle": IconAlertTriangle,
214 "exclamationmark.circle": IconAlertCircle,
215 eye: IconEye,
216 "eye.slash": IconEyeOff,
217 flask: IconFlask,
218 folder: IconFolder,
219 "folder.badge.plus": IconFolderPlus,
220 "folder.fill": IconFolder,
221 gearshape: IconSettings,
222 globe: IconWorld,
223 hammer: IconHammer,
224 headphones: IconHeadphones,
225 house: IconHome,
226 "info.circle": IconInfoCircle,
227 internaldrive: IconDatabase,
228 iphone: IconDeviceMobile,
229 keyboard: IconKeyboard,
230 laptopcomputer: IconDeviceLaptop,
231 link: IconLink,
232 "list.number": IconListNumbers,
233 "line.3.horizontal": IconMenu2,
234 "line.3.horizontal.decrease": IconFilter,
235 "line.3.horizontal.decrease.circle": IconFilter,
236 "line.3.horizontal.decrease.circle.fill": IconFilterFilled,
237 macmini: IconServer,
238 macstudio: IconDeviceDesktop,
239 magnifyingglass: IconSearch,
240 mic: IconMicrophone,
241 paintbrush: IconPalette,
242 pencil: IconPencil,
243 "person.crop.circle": IconUserCircle,
244 "person.2": IconUsers,
245 "person.fill.checkmark": IconUserCheck,
246 "person.fill.xmark": IconUserX,
247 "person.badge.clock": IconUserQuestion,
248 "person.badge.plus": IconUserPlus,
249 photo: IconPhoto,
250 pin: IconPin,
251 "pin.slash": IconPinnedOff,
252 play: IconPlayerPlay,
253 pause: IconPlayerPause,
254 plus: IconPlus,
255 minus: IconMinus,
256 "slash.circle": IconBan,
257 "qrcode.viewfinder": IconQrcode,
258 "point.3.connected.trianglepath.dotted": IconNetwork,
259 flowchart: IconSitemap,
260 "point.topleft.down.curvedto.point.bottomright.up": IconGitMerge,
261 safari: IconExternalLink,
262 "server.rack": IconServer,
263 stethoscope: IconStethoscope,
264 "sidebar.left": IconLayoutSidebar,
265 "sidebar.right": IconLayoutSidebarRight,
266 "slider.horizontal.3": IconAdjustmentsHorizontal,
267 "square.and.arrow.up": IconShare,
268 "square.and.pencil": IconEdit,
269 "square.on.square": IconCopy,
270 "square.grid.2x2": IconApps,
271 "square.split.2x1": IconLayoutColumns,
272 star: IconStar,
273 "star.fill": IconStarFilled,
274 "sun.max": IconSun,
275 "stop.fill": IconPlayerStopFilled,
276 target: IconTarget,
277 terminal: IconTerminal2,
278 "text.alignleft": IconAlignLeft,
279 "text.bubble": IconMessage,
280 "questionmark.bubble": IconMessageCircleQuestion,
281 "exclamationmark.shield": IconShieldQuestion,
282 "bubble.left.and.bubble.right": IconMessage,
283 "bubble.left": IconMessage,
284 "plus.bubble": IconMessagePlus,
285 "ellipsis.bubble": IconMessageDots,
286 robot: IconRobot,
287 "text.word.spacing": IconLetterSpacing,
288 "textformat.size": IconTypography,
289 "textformat.size.larger": IconTextIncrease,
290 "textformat.size.smaller": IconTextDecrease,
291 "tray.and.arrow.down": IconDownload,
292 "tray.and.arrow.up": IconUpload,
293 trash: IconTrash,
294 wifi: IconWifi,
295 "wifi.slash": IconWifiOff,
296 "wrench.and.screwdriver": IconTool,
297 xmark: IconX,
298 "xmark.circle.fill": IconCircleXFilled,
299} satisfies Partial<
300 Record<
301 | SFSymbol
302 | "git.pull-request.closed"
303 | "git.pull-request.draft"
304 | "git.commit"
305 | "file.diff"
306 | "robot",
307 Icon
308 >
309>;
310const SF_ICON_LOOKUP: Partial<
311 Record<
312 | SFSymbol
313 | "git.pull-request.closed"
314 | "git.pull-request.draft"
315 | "git.commit"
316 | "file.diff"
317 | "robot",
318 Icon
319 >
320> = ANDROID_ICON_BY_SF_SYMBOL;
321
322const ANDROID_ICON_BY_MATERIAL_NAME = {
323 bolt: IconBolt,
324 build: IconTool,
325 chat: IconMessage,
326 chat_bubble: IconMessage,
327 check: IconCheck,
328 close: IconX,
329 construction: IconHammer,
330 content_copy: IconCopy,
331 content_paste: IconClipboard,
332 desktop_windows: IconDeviceDesktop,
333 edit: IconEdit,
334 error: IconAlertCircle,
335 folder: IconFolder,
336 folder_open: IconFolderOpen,
337 keyboard: IconKeyboard,
338 keyboard_arrow_down: IconChevronDown,
339 keyboard_arrow_up: IconChevronUp,
340 keyboard_hide: IconKeyboardHide,
341 lock: IconLock,
342 more_vert: IconDotsVertical,
343 merge: IconGitMerge,
344 psychology: IconBrain,
345 public: IconWorld,
346 remove: IconMinus,
347 smartphone: IconDeviceMobile,
348 terminal: IconTerminal2,
349 visibility: IconEye,
350} satisfies Partial<Record<AndroidSymbol, Icon>>;
351
352export type { SFSymbol } from "expo-symbols";
353export type AppSymbolName =
354 | keyof typeof ANDROID_ICON_BY_SF_SYMBOL
355 | {
356 ios: SFSymbol;
357 android: keyof typeof ANDROID_ICON_BY_MATERIAL_NAME;
358 };
359
360export type AppSymbolViewProps = Omit<SymbolViewProps, "name"> & { name: AppSymbolName };
361
362export function isAppSymbolName(name: string): name is Extract<AppSymbolName, string> {
363 return Object.prototype.hasOwnProperty.call(ANDROID_ICON_BY_SF_SYMBOL, name);
364}
365
366function AppSymbolView(props: AppSymbolViewProps) {
367 const materialName = typeof props.name === "string" ? undefined : props.name.android;
368 const sfSymbol = typeof props.name === "string" ? props.name : props.name.ios;
369 const AndroidIcon =
370 (materialName ? ANDROID_ICON_BY_MATERIAL_NAME[materialName] : undefined) ??
371 (sfSymbol ? SF_ICON_LOOKUP[sfSymbol] : undefined);
372
373 if (!AndroidIcon) {
374 return props.fallback ?? null;
375 }
376
377 // react-native-svg applies style.transform to its inner path around (0,0), so a
378 // rotated icon draws outside its box. Transform a wrapping View instead.
379 const transformed = StyleSheet.flatten(props.style)?.transform !== undefined;
380 const icon = (
381 <AndroidIcon
382 accessibilityLabel={props.accessibilityLabel}
383 color={props.tintColor}
384 size={props.size}
385 strokeWidth={2}
386 style={transformed ? undefined : props.style}
387 testID={props.testID}
388 />
389 );
390 return transformed ? <View style={props.style}>{icon}</View> : icon;
391}
392
393export const SymbolView = withUniwind(AppSymbolView);