Merge pull request #17596 from iRoachie/master

Added definitions for react-native-svg-uri
This commit is contained in:
Paul van Brenk
2017-06-29 12:31:31 -07:00
committed by GitHub
4 changed files with 77 additions and 0 deletions

40
types/react-native-svg-uri/index.d.ts vendored Normal file
View File

@@ -0,0 +1,40 @@
// Type definitions for react-native-svg-uri 1.2
// Project: https://github.com/matiascba/react-native-svg-uri#readme
// Definitions by: Kyle Roach <https://github.com/iRoachie>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as React from 'react';
import { ImageURISource } from 'react-native';
export interface SvgUriProps {
/**
* The width of the rendered svg
*/
width?: number | string;
/**
* The height of the rendered svg
*/
height?: number | string;
/**
* Source path for the .svg file
* Expects a require('path') to the file or object with uri.
* e.g. source={require('my-path')}
* e.g. source={{ur: 'my-path'}}
*/
source?: ImageURISource;
/**
* Direct svg code to render. Similar to inline svg
*/
svgXmlData?: string;
/**
* Fill color for the svg object
*/
fill?: string;
}
export default class SvgUri extends React.Component<SvgUriProps, {}> { }

View File

@@ -0,0 +1,13 @@
import * as React from 'react';
import { View } from 'react-native';
import SvgUri from 'react-native-svg-uri';
const TestSvgUri = () => (
<View>
<SvgUri
width="200"
height="200"
source={{ uri: 'http://thenewcode.com/assets/images/thumbnails/homer-simpson.svg' }}
/>
</View>
);

View File

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

View File

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