-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
index.js.flow
85 lines (71 loc) · 1.71 KB
/
index.js.flow
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* @flow strict
*/
import { PureComponent } from 'react';
export type Color = number | string;
export type IconButtonProps<Glyphs: string> = {
backgroundColor?: Color,
borderRadius?: number,
color?: Color,
name: Glyphs,
size?: number,
...
};
declare class IconButton<Glyphs: string> extends PureComponent<
IconButtonProps<Glyphs>
> {}
export type IconProps<Glyphs: string> = {
allowFontScaling?: boolean,
color?: Color,
name: Glyphs,
size?: number,
...
};
export type ImageSource = {|
uri: string,
scale: number,
|};
declare class Icon<Glyphs: string> extends PureComponent<IconProps<Glyphs>> {
static Button: Class<IconButton<Glyphs>>;
static getFontFamily(): string;
static getImageSource(
name: Glyphs,
size?: number,
color?: Color
): Promise<ImageSource>;
static getImageSourceSync(
name: Glyphs,
size?: number,
color?: Color
): ImageSource;
static getRawGlyphMap(): { [name: Glyphs]: number };
static hasIcon(name: string): boolean;
static loadFont(file?: string): Promise<void>;
}
export type { Icon };
declare export function createIconSet<GlyphMap: { [key: string]: number }>(
glyphMap: GlyphMap,
fontFamily: string,
fontFile?: string
): Class<Icon<$Keys<GlyphMap>>>;
export type FontelloConfig = {
glyphs: Array<{
css: string,
code: number,
}>,
};
declare export function createIconSetFromFontello(
config: FontelloConfig,
fontFamily?: string,
fontFile?: string
): Class<Icon<string>>;
export type IcoMoonConfig = {
icons: Array<{
properties: { name: string, code: number },
}>,
};
declare export function createIconSetFromIcoMoon(
config: IcoMoonConfig,
fontFamily?: string,
fontFile?: string
): Class<Icon<string>>;