diff --git a/types/react-native-canvas/index.d.ts b/types/react-native-canvas/index.d.ts new file mode 100644 index 0000000000..3dae92869f --- /dev/null +++ b/types/react-native-canvas/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for react-native-canvas 0.1 +// Project: https://github.com/iddan/react-native-canvas#readme +// Definitions by: hmajid2301 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from "react"; +import { StyleProp, ViewStyle } from "react-native"; + +export interface CanvasProps { + style: StyleProp; + baseUrl: string; + originWhitelist: string[]; +} + +export default class Canvas extends React.Component {} +export class Image extends React.Component {} +export class ImageData extends React.Component {} +export class Path2D extends React.Component {} diff --git a/types/react-native-canvas/react-native-canvas-tests.tsx b/types/react-native-canvas/react-native-canvas-tests.tsx new file mode 100644 index 0000000000..1914b78d09 --- /dev/null +++ b/types/react-native-canvas/react-native-canvas-tests.tsx @@ -0,0 +1,19 @@ +import * as React from "react"; +import { View } from "react-native"; +import Canvas, { + Image as CanvasImage, + Path2D, + ImageData +} from "react-native-canvas"; + +class CanvasTest extends React.Component { + render() { + return ( + + + + ); + } + + handleCanvas = (canvas: Canvas) => {}; +} diff --git a/types/react-native-canvas/tsconfig.json b/types/react-native-canvas/tsconfig.json new file mode 100644 index 0000000000..ef85b41bd1 --- /dev/null +++ b/types/react-native-canvas/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react-native" + }, + "files": ["index.d.ts", "react-native-canvas-tests.tsx"] +} diff --git a/types/react-native-canvas/tslint.json b/types/react-native-canvas/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-canvas/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }