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