UNPKG

1.38 kBTypeScriptView Raw
1import { Component } from "react";
2import { Icon, IconButtonProps, IconProps, ImageSource } from "./Icon";
3
4export const FA5Style: {
5 regular: 0;
6 light: 1;
7 solid: 2;
8 brand: 3;
9};
10
11export type ValueOf<T> = T[keyof T];
12
13// borrowed from
14// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html
15export type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
16
17export type FontAwesome5IconVariants = keyof Omit<typeof FA5Style, "regular">;
18
19export type FontAwesome5IconProps = { [K in FontAwesome5IconVariants]?: boolean } & IconProps;
20
21export class FontAwesome5IconButton extends Component<
22 { [K in FontAwesome5IconVariants]?: boolean } & IconButtonProps,
23 any
24> {}
25
26export default class FontAwesome5Icon extends Component<
27 FontAwesome5IconProps,
28 any
29> {
30 static getImageSource(
31 name: string,
32 size?: number,
33 color?: string,
34 fa5Style?: ValueOf<typeof FA5Style>,
35 ): Promise<ImageSource>;
36 static getImageSourceSync(
37 name: string,
38 size?: number,
39 color?: string,
40 fa5Style?: ValueOf<typeof FA5Style>,
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 FontAwesome5IconButton;
47}