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