| 1 | import IconGitBranch from "@tabler/icons-react-native/IconGitBranch"; |
| 2 | import IconGitMerge from "@tabler/icons-react-native/IconGitMerge"; |
| 3 | import IconGitCommit from "@tabler/icons-react-native/IconGitCommit"; |
| 4 | import IconGitPullRequestClosed from "@tabler/icons-react-native/IconGitPullRequestClosed"; |
| 5 | import IconGitPullRequestDraft from "@tabler/icons-react-native/IconGitPullRequestDraft"; |
| 6 | import type { SFSymbol } from "expo-symbols"; |
| 7 | import IconGitPullRequest from "@tabler/icons-react-native/IconGitPullRequest"; |
| 8 | import IconFileDiff from "@tabler/icons-react-native/IconFileDiff"; |
| 9 | import { SymbolView as ExpoSymbolView } from "expo-symbols"; |
| 10 | import { withUniwind } from "uniwind"; |
| 11 | import type { AppSymbolViewProps } from "./AppSymbol"; |
| 12 | |
| 13 | export type { SFSymbol } from "expo-symbols"; |
| 14 | export type { AppSymbolName } from "./AppSymbol"; |
| 15 | |
| 16 | const CUSTOM_ICONS = { |
| 17 | "file.diff": IconFileDiff, |
| 18 | "arrow.triangle.pull": IconGitPullRequest, |
| 19 | "arrow.triangle.merge": IconGitMerge, |
| 20 | "arrow.triangle.branch": IconGitBranch, |
| 21 | "arrow.branch": IconGitBranch, |
| 22 | "git.pull-request.closed": IconGitPullRequestClosed, |
| 23 | "git.pull-request.draft": IconGitPullRequestDraft, |
| 24 | "git.commit": IconGitCommit, |
| 25 | }; |
| 26 | |
| 27 | function AppSymbolView(props: AppSymbolViewProps) { |
| 28 | const name = typeof props.name === "string" ? props.name : props.name.ios; |
| 29 | const CustomIcon = CUSTOM_ICONS[name as keyof typeof CUSTOM_ICONS]; |
| 30 | if (CustomIcon) { |
| 31 | return ( |
| 32 | <CustomIcon |
| 33 | accessibilityLabel={props.accessibilityLabel} |
| 34 | color={props.tintColor} |
| 35 | size={props.size} |
| 36 | strokeWidth={2} |
| 37 | style={props.style} |
| 38 | testID={props.testID} |
| 39 | /> |
| 40 | ); |
| 41 | } |
| 42 | |
| 43 | return <ExpoSymbolView {...props} name={name as SFSymbol} />; |
| 44 | } |
| 45 | |
| 46 | export const SymbolView = withUniwind(AppSymbolView); |