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