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