UNPKG

1.42 kBTypeScriptView Raw
1import { Component } from "react";
2import { Icon, IconButtonProps, IconProps, ImageSource } from "./Icon";
3
4export const FA6Style: {
5 regular: 0;
6 light: 1;
7 solid: 2;
8 brand: 3;
9 sharpSolid: 4;
10 duotone: 5;
11 thin: 6;
12};
13
14export type ValueOf<T> = T[keyof T];
15
16// borrowed from
17// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html
18export type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
19
20export type FontAwesome6IconVariants = keyof Omit<typeof FA6Style, "regular">;
21
22export type FontAwesome6IconProps = { [K in FontAwesome6IconVariants]?: boolean } & IconProps;
23
24export class FontAwesome6IconButton extends Component<
25 { [K in FontAwesome6IconVariants]?: boolean } & IconButtonProps,
26 any
27> {}
28
29export default class FontAwesome6Icon extends Component<FontAwesome6IconProps, any> {
30 static getImageSource(
31 name: string,
32 size?: number,
33 color?: string,
34 fa6Style?: ValueOf<typeof FA6Style>,
35 ): Promise<ImageSource>;
36 static getImageSourceSync(
37 name: string,
38 size?: number,
39 color?: string,
40 fa6Style?: ValueOf<typeof FA6Style>,
41 ): ImageSource;
42 static loadFont(file?: string): Promise<void>;
43 static hasIcon(name: string): boolean;
44 static TabBarItem: typeof Icon.TabBarItem;
45 static TabBarItemIOS: typeof Icon.TabBarItemIOS;
46 static Button: typeof FontAwesome6IconButton;
47}