Skip to content

Commit

Permalink
feat: Create Typescript definitions (#51)
Browse files Browse the repository at this point in the history
* [Typescript] Created Typescript definitions

* Update index.d.ts
  • Loading branch information
franklixuefei authored and okonet committed Jul 18, 2018
1 parent ff18f61 commit 4262093
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import * as React from 'react';

export interface Dimensions {
top: number;
right: number;
bottom: number;
left: number;
width: number;
height: number;
}

export interface ContainerDimensionsProps {
/**
* Can either be a function that's responsible for rendering children.
* This function should implement the following signature:
* ({ height, width }) => PropTypes.element
* Or a React element, with width and height injected into its props.
*/
children: ((props: Dimensions) => React.ReactNode) | React.ReactNode;
}

/**
* Component that automatically adjusts the width and height of a single child.
* Child component should not be declared as a child but should rather be specified by a `ChildComponent` property.
* All other properties will be passed through to the child component.
*/
declare const ContainerDimensions: React.ComponentType<ContainerDimensionsProps>;
export default ContainerDimensions;

0 comments on commit 4262093

Please sign in to comment.