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