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