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