Skip to content

Instantly share code, notes, and snippets.

@navono
Created September 28, 2018 05:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navono/51c5a705289946210290c8f7777b43e1 to your computer and use it in GitHub Desktop.
Save navono/51c5a705289946210290c8f7777b43e1 to your computer and use it in GitHub Desktop.
A demo declaration file of react-resizable
declare module 'react-resizable' {
import * as React from 'react';
type Axis = 'both' | 'x' | 'y' | 'none';
type ResizeCallbackData = {
node: HTMLElement,
size: {width: number, height: number}
};
interface IResizableProps {
children?: React.ReactElement<any>;
className?: string;
width: number;
height: number;
handleSize?: [number, number];
lockAspectRatio?: boolean;
axis?: Axis;
minConstraints?: [number, number];
maxConstraints?: [number, number];
onResizeStop?: (e: React.SyntheticEvent<any>, data: ResizeCallbackData) => any,
onResizeStart?: (e: React.SyntheticEvent<any>, data: ResizeCallbackData) => any,
onResize?: (e: React.SyntheticEvent<any>, data: ResizeCallbackData) => any,
draggableOpts?: any;
}
export class Resizable extends React.Component<IResizableProps, any> {
constructor(props: IResizableProps);
componentDidMount(): void;
componentDidUpdate(prevProps: IResizableProps): void;
componentWillUnmount(): void;
render(): JSX.Element;
}
export class ResizableBox extends React.Component<IResizableProps, any> {
constructor(props: IResizableProps);
componentDidMount(): void;
componentDidUpdate(prevProps: IResizableProps): void;
componentWillUnmount(): void;
render(): JSX.Element;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment