Merge pull request #116 from ascariandrea/types-definition

Created types definition.
This commit is contained in:
Dylan Vann 2018-01-31 21:40:51 -05:00 committed by GitHub
commit 01dea791b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 1 deletions

56
index.d.ts vendored Normal file
View File

@ -0,0 +1,56 @@
import * as React from 'react';
import { ObjectOverwrite } from 'typelevel-ts';
import { ImageProperties, ImageStatic } from 'react-native';
declare namespace FastImage {
export namespace priority {
type low = 'low';
type normal = 'normal';
type high = 'high';
}
type priority =
FastImage.priority.low |
FastImage.priority.normal |
FastImage.priority.high;
export namespace resizeMode {
type contain = 'contain';
type cover = 'cover';
type stretch = 'stretch';
type center = 'center';
}
export type resizeMode =
FastImage.resizeMode.contain |
FastImage.resizeMode.cover |
FastImage.resizeMode.stretch |
FastImage.resizeMode.center
}
export type FastImageSource = {
uri?: string,
headers?: object;
priority?: FastImage.priority;
};
export type FastImageProperties = ObjectOverwrite<ImageProperties, {
source: FastImageSource | number,
resizeMode?: FastImage.resizeMode;
onLoadStart?(): void;
onprogress?(event: any): void;
onLoad?(): void;
onError?(): void;
onLoadEnd?(): void;
}>;
interface FastImageStatic extends React.ComponentClass<FastImageProperties> {
resizeMode: FastImage.resizeMode;
preload(sources: Array<FastImageProperties['source']>): void;
}
declare var FastImage: FastImageStatic;
type FastImage = FastImageStatic;
export default FastImage;

View File

@ -47,7 +47,8 @@
"prettier-check": "^2.0.0",
"react": "16.0.0",
"react-native": "^0.50.4",
"react-test-renderer": "16.0.0"
"react-test-renderer": "16.0.0",
"typelevel-ts": "^0.2.2"
},
"jest": {
"preset": "react-native",

View File

@ -4074,6 +4074,10 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
typelevel-ts@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/typelevel-ts/-/typelevel-ts-0.2.2.tgz#a8f9a0a77e7d747e4990a4819db9bb87f79fe012"
ua-parser-js@^0.7.9:
version "0.7.13"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.13.tgz#cd9dd2f86493b3f44dbeeef3780fda74c5ee14be"