Open History to see the last commit
1import type { Icon } from "@tabler/icons-react-native/types";
2/*
3 * Keep these as per-icon exports. Importing the package root eagerly registers
4 * the entire Tabler icon set in Metro.
5 */
6import IconAdjustmentsHorizontal from "@tabler/icons-react-native/IconAdjustmentsHorizontal";
7import IconAlignLeft from "@tabler/icons-react-native/IconAlignLeft";
8import IconAlertCircle from "@tabler/icons-react-native/IconAlertCircle";
9import IconAlertTriangle from "@tabler/icons-react-native/IconAlertTriangle";
10import IconApps from "@tabler/icons-react-native/IconApps";
11import IconArchive from "@tabler/icons-react-native/IconArchive";
12import IconArrowBackUp from "@tabler/icons-react-native/IconArrowBackUp";
13import IconArrowDown from "@tabler/icons-react-native/IconArrowDown";
14import IconArrowForwardUp from "@tabler/icons-react-native/IconArrowForwardUp";
15import IconArrowLeft from "@tabler/icons-react-native/IconArrowLeft";
16import IconArrowRight from "@tabler/icons-react-native/IconArrowRight";
17import IconArrowDownCircle from "@tabler/icons-react-native/IconArrowDownCircle";
18import IconArrowRightCircle from "@tabler/icons-react-native/IconArrowRightCircle";
19import IconArrowUp from "@tabler/icons-react-native/IconArrowUp";
20import IconArrowUpCircle from "@tabler/icons-react-native/IconArrowUpCircle";
21import IconArrowUpRight from "@tabler/icons-react-native/IconArrowUpRight";
22import IconArrowUpRightCircle from "@tabler/icons-react-native/IconArrowUpRightCircle";
23import IconArrowsLeftRight from "@tabler/icons-react-native/IconArrowsLeftRight";
24import IconArrowsDiagonal2 from "@tabler/icons-react-native/IconArrowsDiagonal2";
25import IconArrowsMinimize from "@tabler/icons-react-native/IconArrowsMinimize";
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 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 IconCircleCheck from "@tabler/icons-react-native/IconCircleCheck";
40import IconCircleDashed from "@tabler/icons-react-native/IconCircleDashed";
41import IconCircleXFilled from "@tabler/icons-react-native/IconCircleXFilled";
42import IconTicket from "@tabler/icons-react-native/IconTicket";
43import IconClock from "@tabler/icons-react-native/IconClock";
44import IconCode from "@tabler/icons-react-native/IconCode";
45import IconCopy from "@tabler/icons-react-native/IconCopy";
46import IconDatabase from "@tabler/icons-react-native/IconDatabase";
47import IconDeviceDesktop from "@tabler/icons-react-native/IconDeviceDesktop";
48import IconDeviceLaptop from "@tabler/icons-react-native/IconDeviceLaptop";
49import IconDeviceMobile from "@tabler/icons-react-native/IconDeviceMobile";
50import IconDots from "@tabler/icons-react-native/IconDots";
51import IconDotsVertical from "@tabler/icons-react-native/IconDotsVertical";
52import IconDotsCircleHorizontal from "@tabler/icons-react-native/IconDotsCircleHorizontal";
53import IconEdit from "@tabler/icons-react-native/IconEdit";
54import IconExternalLink from "@tabler/icons-react-native/IconExternalLink";
55import IconEye from "@tabler/icons-react-native/IconEye";
56import IconFileText from "@tabler/icons-react-native/IconFileText";
57import IconFilter from "@tabler/icons-react-native/IconFilter";
58import IconFilterFilled from "@tabler/icons-react-native/IconFilterFilled";
59import IconFolder from "@tabler/icons-react-native/IconFolder";
60import IconFolderOpen from "@tabler/icons-react-native/IconFolderOpen";
61import IconFolderPlus from "@tabler/icons-react-native/IconFolderPlus";
62import IconGitBranch from "@tabler/icons-react-native/IconGitBranch";
63import IconGitMerge from "@tabler/icons-react-native/IconGitMerge";
64import IconGitPullRequest from "@tabler/icons-react-native/IconGitPullRequest";
65import IconHammer from "@tabler/icons-react-native/IconHammer";
66import IconHome from "@tabler/icons-react-native/IconHome";
67import IconInfoCircle from "@tabler/icons-react-native/IconInfoCircle";
68import IconKeyboard from "@tabler/icons-react-native/IconKeyboard";
69import IconKeyboardHide from "@tabler/icons-react-native/IconKeyboardHide";
70import IconLock from "@tabler/icons-react-native/IconLock";
71import IconLayoutColumns from "@tabler/icons-react-native/IconLayoutColumns";
72import IconLayoutSidebar from "@tabler/icons-react-native/IconLayoutSidebar";
73import IconLayoutSidebarRight from "@tabler/icons-react-native/IconLayoutSidebarRight";
74import IconLetterSpacing from "@tabler/icons-react-native/IconLetterSpacing";
75import IconMicrophone from "@tabler/icons-react-native/IconMicrophone";
76import IconLink from "@tabler/icons-react-native/IconLink";
77import IconListNumbers from "@tabler/icons-react-native/IconListNumbers";
78import IconMenu2 from "@tabler/icons-react-native/IconMenu2";
79import IconMessageCircleQuestion from "@tabler/icons-react-native/IconMessageCircleQuestion";
80import IconMessage from "@tabler/icons-react-native/IconMessage";
81import IconMinus from "@tabler/icons-react-native/IconMinus";
82import IconMoon from "@tabler/icons-react-native/IconMoon";
83import IconNetwork from "@tabler/icons-react-native/IconNetwork";
84import IconPalette from "@tabler/icons-react-native/IconPalette";
85import IconPencil from "@tabler/icons-react-native/IconPencil";
86import IconPhoto from "@tabler/icons-react-native/IconPhoto";
87import IconPin from "@tabler/icons-react-native/IconPin";
88import IconPinnedOff from "@tabler/icons-react-native/IconPinnedOff";
89import IconPlayerPlay from "@tabler/icons-react-native/IconPlayerPlay";
90import IconPlayerStopFilled from "@tabler/icons-react-native/IconPlayerStopFilled";
91import IconPlus from "@tabler/icons-react-native/IconPlus";
92import IconQrcode from "@tabler/icons-react-native/IconQrcode";
93import IconRefresh from "@tabler/icons-react-native/IconRefresh";
94import IconSearch from "@tabler/icons-react-native/IconSearch";
95import IconServer from "@tabler/icons-react-native/IconServer";
96import IconSettings from "@tabler/icons-react-native/IconSettings";
97import IconSparkles from "@tabler/icons-react-native/IconSparkles";
98import IconStack2 from "@tabler/icons-react-native/IconStack2";
99import IconStar from "@tabler/icons-react-native/IconStar";
100import IconStarFilled from "@tabler/icons-react-native/IconStarFilled";
101import IconStethoscope from "@tabler/icons-react-native/IconStethoscope";
102import IconSun from "@tabler/icons-react-native/IconSun";
103import IconShieldQuestion from "@tabler/icons-react-native/IconShieldQuestion";
104import IconTarget from "@tabler/icons-react-native/IconTarget";
105import IconTerminal2 from "@tabler/icons-react-native/IconTerminal2";
106import IconTextDecrease from "@tabler/icons-react-native/IconTextDecrease";
107import IconTextIncrease from "@tabler/icons-react-native/IconTextIncrease";
108import IconTool from "@tabler/icons-react-native/IconTool";
109import IconTrash from "@tabler/icons-react-native/IconTrash";
110import IconTypography from "@tabler/icons-react-native/IconTypography";
111import IconUpload from "@tabler/icons-react-native/IconUpload";
112import IconUserCircle from "@tabler/icons-react-native/IconUserCircle";
113import IconUsers from "@tabler/icons-react-native/IconUsers";
114import IconWifi from "@tabler/icons-react-native/IconWifi";
115import IconWifiOff from "@tabler/icons-react-native/IconWifiOff";
116import IconWorld from "@tabler/icons-react-native/IconWorld";
117import IconX from "@tabler/icons-react-native/IconX";
118import type { AndroidSymbol, SFSymbol, SymbolViewProps } from "expo-symbols";
119import { withUniwind } from "uniwind";
120
121const ANDROID_ICON_BY_SF_SYMBOL = {
122 "arrow.branch": IconGitBranch,
123 "arrow.left": IconArrowLeft,
124 "arrow.right": IconArrowRight,
125 "arrow.left.arrow.right": IconArrowsLeftRight,
126 "arrow.clockwise": IconRefresh,
127 "arrow.down": IconArrowDown,
128 "arrow.down.circle": IconArrowDownCircle,
129 "arrow.right.circle": IconArrowRightCircle,
130 "arrow.triangle.branch": IconGitBranch,
131 "arrow.triangle.merge": IconGitMerge,
132 "arrow.triangle.pull": IconGitPullRequest,
133 "square.3.layers.3d": IconStack2,
134 "arrow.turn.left.up": IconArrowBackUp,
135 "arrow.up": IconArrowUp,
136 "arrow.up.circle": IconArrowUpCircle,
137 "arrow.up.left.and.arrow.down.right": IconArrowsDiagonal2,
138 "arrow.down.right.and.arrow.up.left": IconArrowsMinimize,
139 "arrow.up.right": IconArrowUpRight,
140 "arrow.up.right.circle": IconArrowUpRightCircle,
141 "arrow.uturn.backward": IconArrowBackUp,
142 "arrow.uturn.forward": IconArrowForwardUp,
143 archivebox: IconArchive,
144 "archivebox.fill": IconArchive,
145 "bell.badge": IconBellRinging,
146 "bolt.circle": IconBolt,
147 "bolt.horizontal.circle": IconBolt,
148 brain: IconBrain,
149 camera: IconCamera,
150 "chart.bar.xaxis": IconChartBar,
151 checkmark: IconCheck,
152 "checkmark.circle": IconCircleCheck,
153 circle: IconCircle,
154 "circle.dashed": IconCircleDashed,
155 clock: IconClock,
156 timer: IconClock,
157 ticket: IconTicket,
158 cloud: IconCloud,
159 cube: IconBox,
160 "chevron.down": IconChevronDown,
161 "chevron.left": IconChevronLeft,
162 "chevron.left.forwardslash.chevron.right": IconCode,
163 "chevron.right": IconChevronRight,
164 "chevron.up": IconChevronUp,
165 desktopcomputer: IconDeviceDesktop,
166 doc: IconFileText,
167 "doc.on.doc": IconCopy,
168 "doc.text": IconFileText,
169 ellipsis: IconDots,
170 moon: IconMoon,
171 "ellipsis.circle": IconDotsCircleHorizontal,
172 "exclamationmark.triangle": IconAlertTriangle,
173 "exclamationmark.circle": IconAlertCircle,
174 eye: IconEye,
175 folder: IconFolder,
176 "folder.badge.plus": IconFolderPlus,
177 "folder.fill": IconFolder,
178 gearshape: IconSettings,
179 globe: IconWorld,
180 hammer: IconHammer,
181 house: IconHome,
182 "info.circle": IconInfoCircle,
183 internaldrive: IconDatabase,
184 keyboard: IconKeyboard,
185 laptopcomputer: IconDeviceLaptop,
186 link: IconLink,
187 "list.number": IconListNumbers,
188 "line.3.horizontal": IconMenu2,
189 "line.3.horizontal.decrease": IconFilter,
190 "line.3.horizontal.decrease.circle": IconFilter,
191 "line.3.horizontal.decrease.circle.fill": IconFilterFilled,
192 // Tabler has no Apple desktops; the closest silhouettes stand in on Android.
193 macmini: IconServer,
194 macstudio: IconDeviceDesktop,
195 magnifyingglass: IconSearch,
196 mic: IconMicrophone,
197 paintbrush: IconPalette,
198 pencil: IconPencil,
199 "person.crop.circle": IconUserCircle,
200 "person.2": IconUsers,
201 photo: IconPhoto,
202 pin: IconPin,
203 "pin.slash": IconPinnedOff,
204 play: IconPlayerPlay,
205 plus: IconPlus,
206 minus: IconMinus,
207 "qrcode.viewfinder": IconQrcode,
208 "point.3.connected.trianglepath.dotted": IconNetwork,
209 "point.topleft.down.curvedto.point.bottomright.up": IconGitMerge,
210 safari: IconExternalLink,
211 "server.rack": IconServer,
212 stethoscope: IconStethoscope,
213 "sidebar.left": IconLayoutSidebar,
214 "sidebar.right": IconLayoutSidebarRight,
215 "slider.horizontal.3": IconAdjustmentsHorizontal,
216 "square.and.pencil": IconEdit,
217 "square.on.square": IconCopy,
218 "square.grid.2x2": IconApps,
219 "square.split.2x1": IconLayoutColumns,
220 star: IconStar,
221 "star.fill": IconStarFilled,
222 "sun.max": IconSun,
223 "stop.fill": IconPlayerStopFilled,
224 target: IconTarget,
225 terminal: IconTerminal2,
226 "text.alignleft": IconAlignLeft,
227 "text.bubble": IconMessage,
228 "questionmark.bubble": IconMessageCircleQuestion,
229 "exclamationmark.shield": IconShieldQuestion,
230 "text.word.spacing": IconLetterSpacing,
231 "textformat.size": IconTypography,
232 "textformat.size.larger": IconTextIncrease,
233 "textformat.size.smaller": IconTextDecrease,
234 "tray.and.arrow.up": IconUpload,
235 trash: IconTrash,
236 wifi: IconWifi,
237 "wifi.slash": IconWifiOff,
238 xmark: IconX,
239 "xmark.circle.fill": IconCircleXFilled,
240} satisfies Partial<Record<SFSymbol, Icon>>;
241const SF_ICON_LOOKUP: Partial<Record<SFSymbol, Icon>> = ANDROID_ICON_BY_SF_SYMBOL;
242
243// Callers can pass `{ ios, android }` names where `android` is a Material
244// icon name (the raw expo-symbols contract). Resolve those here too so the
245// android key keeps working through this wrapper — it wins over the SF map
246// when both match (e.g. folder vs folder_open for expanded project groups).
247const ANDROID_ICON_BY_MATERIAL_NAME = {
248 auto_awesome: IconSparkles,
249 bolt: IconBolt,
250 build: IconTool,
251 chat: IconMessage,
252 chat_bubble: IconMessage,
253 check: IconCheck,
254 close: IconX,
255 construction: IconHammer,
256 content_copy: IconCopy,
257 desktop_windows: IconDeviceDesktop,
258 edit: IconEdit,
259 error: IconAlertCircle,
260 folder: IconFolder,
261 folder_open: IconFolderOpen,
262 keyboard: IconKeyboard,
263 keyboard_arrow_down: IconChevronDown,
264 keyboard_arrow_up: IconChevronUp,
265 keyboard_hide: IconKeyboardHide,
266 lock: IconLock,
267 more_vert: IconDotsVertical,
268 merge: IconGitMerge,
269 psychology: IconBrain,
270 public: IconWorld,
271 remove: IconMinus,
272 smartphone: IconDeviceMobile,
273 terminal: IconTerminal2,
274 visibility: IconEye,
275} satisfies Partial<Record<AndroidSymbol, Icon>>;
276
277export type { SFSymbol } from "expo-symbols";
278export type AppSymbolName =
279 | keyof typeof ANDROID_ICON_BY_SF_SYMBOL
280 | {
281 ios: SFSymbol;
282 android: keyof typeof ANDROID_ICON_BY_MATERIAL_NAME;
283 };
284
285export type AppSymbolViewProps = Omit<SymbolViewProps, "name"> & { name: AppSymbolName };
286
287export function isAppSymbolName(name: string): name is Extract<AppSymbolName, string> {
288 return Object.prototype.hasOwnProperty.call(ANDROID_ICON_BY_SF_SYMBOL, name);
289}
290
291function AppSymbolView(props: AppSymbolViewProps) {
292 const materialName = typeof props.name === "string" ? undefined : props.name.android;
293 const sfSymbol = typeof props.name === "string" ? props.name : props.name.ios;
294 const AndroidIcon =
295 (materialName ? ANDROID_ICON_BY_MATERIAL_NAME[materialName] : undefined) ??
296 (sfSymbol ? SF_ICON_LOOKUP[sfSymbol] : undefined);
297
298 if (!AndroidIcon) {
299 return props.fallback ?? null;
300 }
301
302 return (
303 <AndroidIcon
304 accessibilityLabel={props.accessibilityLabel}
305 color={props.tintColor}
306 size={props.size}
307 strokeWidth={2}
308 style={props.style}
309 testID={props.testID}
310 />
311 );
312}
313
314/**
315 * expo-symbols and the Android Tabler fallback both expose tint as a native
316 * prop rather than a React Native style. Keep that third-party boundary here
317 * so callers can use Uniwind's `tintColorClassName` instead of subscribing to
318 * theme variables in every parent component.
319 */
320export const SymbolView = withUniwind(AppSymbolView);