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