Add types for react-native-scaled-image (#29397)

* Add types for react-native-scaled-image

* Lint fixes
This commit is contained in:
Matt Jaeger
2018-10-05 14:47:20 -07:00
committed by Wesley Wigham
parent 353934d836
commit e29dafe1b2
4 changed files with 50 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
// Type definitions for react-native-scaled-image 0.0
// Project: https://github.com/nanlabs/react-native-scaled-image
// Definitions by: Matt Jaeger <https://github.com/Jaeger25>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
import { ImageSourcePropType, StyleProp, ImageStyle } from 'react-native';
export interface ScaledImageProps {
source: ImageSourcePropType;
height?: number;
width?: number;
style?: StyleProp<ImageStyle>;
}
export default class ScaledImage extends React.Component<ScaledImageProps> {}

View File

@@ -0,0 +1,15 @@
import * as React from 'react';
import ScaledImage from 'react-native-scaled-image';
class Example extends React.Component {
render() {
return (
<ScaledImage
source={require('image.png')}
style={{ resizeMode: 'contain' }}
width={360} />
);
}
}
export default Example;

View File

@@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"jsx": "react-native",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "react-native-scaled-image-tests.tsx"]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }