108 lines
2.5 KiB
TypeScript
Raw Normal View History

2018-01-31 22:16:32 -05:00
import * as React from 'react'
import { FlexStyle, LayoutChangeEvent, ShadowStyleIOS, StyleProp, TransformsStyle } from 'react-native'
2017-12-27 15:12:01 +01:00
declare namespace FastImage {
2018-01-31 22:40:40 -05:00
namespace priority {
2018-01-31 22:16:32 -05:00
type low = 'low'
type normal = 'normal'
type high = 'high'
}
2018-01-31 22:40:40 -05:00
namespace resizeMode {
2018-01-31 22:16:32 -05:00
type contain = 'contain'
type cover = 'cover'
type stretch = 'stretch'
type center = 'center'
}
2018-01-31 22:40:40 -05:00
export type Priority =
FastImage.priority.low |
FastImage.priority.normal |
FastImage.priority.high
export type ResizeMode =
2018-01-31 22:16:32 -05:00
FastImage.resizeMode.contain |
FastImage.resizeMode.cover |
FastImage.resizeMode.stretch |
FastImage.resizeMode.center
2017-12-27 15:12:01 +01:00
}
export type FastImageSource = {
2018-01-31 22:16:32 -05:00
uri?: string,
headers?: object
2018-01-31 22:40:40 -05:00
priority?: FastImage.Priority
2018-01-31 22:16:32 -05:00
}
export interface ImageStyle extends FlexStyle, TransformsStyle, ShadowStyleIOS {
backfaceVisibility?: 'visible' | 'hidden'
borderBottomLeftRadius?: number;
borderBottomRightRadius?: number;
backgroundColor?: string;
borderColor?: string;
borderWidth?: number;
borderRadius?: number;
borderTopLeftRadius?: number;
borderTopRightRadius?: number;
2018-01-31 22:16:32 -05:00
overlayColor?: string
tintColor?: string
opacity?: number
}
export interface FastImageProperties {
source: FastImageSource | number
2018-01-31 22:40:40 -05:00
resizeMode?: FastImage.ResizeMode
2018-01-31 22:16:32 -05:00
onLoadStart?(): void
onProgress?(event: any): void
onLoad?(): void
onError?(): void
onLoadEnd?(): void
/**
* onLayout function
*
* Invoked on mount and layout changes with
*
* {nativeEvent: { layout: {x, y, width, height}}}.
*/
onLayout?: (event: LayoutChangeEvent) => void;
/**
*
* Style
*/
style?: StyleProp<ImageStyle>;
/**
* A unique identifier for this element to be used in UI Automation testing scripts.
*/
testID?: string;
}
2017-12-27 15:12:01 +01:00
interface FastImageStatic extends React.ComponentClass<FastImageProperties> {
2018-01-31 22:40:40 -05:00
resizeMode: {
contain: FastImage.resizeMode.contain
cover: FastImage.resizeMode.cover
stretch: FastImage.resizeMode.stretch
center: FastImage.resizeMode.center
}
priority: {
low: FastImage.priority.low
normal: FastImage.priority.normal
high: FastImage.priority.high
}
2018-01-31 22:16:32 -05:00
preload(sources: FastImageSource[]): void
2017-12-27 15:12:01 +01:00
}
2018-01-31 22:16:32 -05:00
declare var FastImage: FastImageStatic
type FastImage = FastImageStatic
2017-12-27 15:12:01 +01:00
2018-01-31 22:16:32 -05:00
export default FastImage