UNPKG

3.04 kBTypeScriptView Raw
1import React from 'react';
2import { FlexStyle, LayoutChangeEvent, ShadowStyleIOS, StyleProp, TransformsStyle, ImageRequireSource, AccessibilityProps, ViewProps, ColorValue } from 'react-native';
3export declare type ResizeMode = 'contain' | 'cover' | 'stretch' | 'center';
4declare const resizeMode: {
5 readonly contain: "contain";
6 readonly cover: "cover";
7 readonly stretch: "stretch";
8 readonly center: "center";
9};
10export declare type Priority = 'low' | 'normal' | 'high';
11declare const priority: {
12 readonly low: "low";
13 readonly normal: "normal";
14 readonly high: "high";
15};
16declare type Cache = 'immutable' | 'web' | 'cacheOnly';
17declare const cacheControl: {
18 readonly immutable: "immutable";
19 readonly web: "web";
20 readonly cacheOnly: "cacheOnly";
21};
22export declare type Source = {
23 uri?: string;
24 headers?: {
25 [key: string]: string;
26 };
27 priority?: Priority;
28 cache?: Cache;
29};
30export interface OnLoadEvent {
31 nativeEvent: {
32 width: number;
33 height: number;
34 };
35}
36export interface OnProgressEvent {
37 nativeEvent: {
38 loaded: number;
39 total: number;
40 };
41}
42export interface ImageStyle extends FlexStyle, TransformsStyle, ShadowStyleIOS {
43 backfaceVisibility?: 'visible' | 'hidden';
44 borderBottomLeftRadius?: number;
45 borderBottomRightRadius?: number;
46 backgroundColor?: string;
47 borderColor?: string;
48 borderWidth?: number;
49 borderRadius?: number;
50 borderTopLeftRadius?: number;
51 borderTopRightRadius?: number;
52 overlayColor?: string;
53 opacity?: number;
54}
55export interface FastImageProps extends AccessibilityProps, ViewProps {
56 source?: Source | ImageRequireSource;
57 defaultSource?: ImageRequireSource;
58 resizeMode?: ResizeMode;
59 fallback?: boolean;
60 onLoadStart?(): void;
61 onProgress?(event: OnProgressEvent): void;
62 onLoad?(event: OnLoadEvent): void;
63 onError?(): void;
64 onLoadEnd?(): void;
65 /**
66 * onLayout function
67 *
68 * Invoked on mount and layout changes with
69 *
70 * {nativeEvent: { layout: {x, y, width, height}}}.
71 */
72 onLayout?: (event: LayoutChangeEvent) => void;
73 /**
74 *
75 * Style
76 */
77 style?: StyleProp<ImageStyle>;
78 /**
79 * TintColor
80 *
81 * If supplied, changes the color of all the non-transparent pixels to the given color.
82 */
83 tintColor?: ColorValue;
84 /**
85 * A unique identifier for this element to be used in UI Automation testing scripts.
86 */
87 testID?: string;
88 /**
89 * Render children within the image.
90 */
91 children?: React.ReactNode;
92}
93export interface FastImageStaticProperties {
94 resizeMode: typeof resizeMode;
95 priority: typeof priority;
96 cacheControl: typeof cacheControl;
97 preload: (sources: Source[]) => void;
98 clearMemoryCache: () => Promise<void>;
99 clearDiskCache: () => Promise<void>;
100}
101declare const FastImage: React.ComponentType<FastImageProps> & FastImageStaticProperties;
102export default FastImage;
103//# sourceMappingURL=index.d.ts.map
\No newline at end of file