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