react-native-vector-icons: fontawesome5, 5pro

This commit is contained in:
Omar Diab
2018-08-14 23:49:28 +09:00
parent f7a204a4c7
commit a54ae6fc5f
2 changed files with 49 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
import { Component } from "../../../../../Library/Caches/typescript/2.9/node_modules/@types/react";
import { Icon, IconProps, ImageSource } from "./Icon";
export const FA5Style: {
regular: 0;
light: 1;
solid: 2;
brand: 3;
};
type ValueOf<T> = T[keyof T];
// borrowed from
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
export type FontAwesome5IconVariants = keyof Omit<typeof FA5Style, "regular">;
// borrowed from https://stackoverflow.com/a/49725198/1105281
type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Omit<T, Keys> &
{
[K in Keys]-?: Required<Pick<T, K>> &
Partial<Record<Exclude<Keys, K>, undefined>>
}[Keys];
export type FontAwesome5IconProps = RequireOnlyOne<
{ [K in FontAwesome5IconVariants]?: boolean } & IconProps,
FontAwesome5IconVariants
>;
export default class FontAwesome5Icon extends Component<
FontAwesome5IconProps,
any
> {
static getImageSource(
name: string,
size?: number,
color?: string,
fa5Style?: ValueOf<typeof FA5Style>
): Promise<ImageSource>;
static loadFont(file?: string): Promise<void>;
static hasIcon(name: string): boolean;
}
+6
View File
@@ -0,0 +1,6 @@
import { Component } from "react";
import FontAwesome5Icon, { FontAwesome5IconProps } from "./FontAwesome5";
export type FontAwesome5ProIconProps = FontAwesome5IconProps;
export { FA5Style } from "./FontAwesome5";
export default FontAwesome5Icon;