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