Merge pull request #24241 from gabsprates/react-avatar-editor_bugfix

fix react-avatar-editor methods
This commit is contained in:
Arthur Ozga
2018-03-15 14:06:27 -07:00
committed by GitHub
2 changed files with 18 additions and 7 deletions
+4 -3
View File
@@ -1,6 +1,7 @@
// Type definitions for react-avatar-editor 10.3
// Project: https://github.com/mosch/react-avatar-editor
// Definitions by: Diogo Corrêa <https://github.com/diogocorrea>
// Gabriel Prates <https://github.com/gabsprates>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -45,7 +46,7 @@ export interface AvatarEditorProps {
}
export default class AvatarEditor extends React.Component<AvatarEditorProps, any> {
static getImage(): HTMLCanvasElement;
static getImageScaledToCanvas(): HTMLCanvasElement;
static getCroppingRect(): CroppedRect;
getImage(): HTMLCanvasElement;
getImageScaledToCanvas(): HTMLCanvasElement;
getCroppingRect(): CroppedRect;
}
@@ -12,6 +12,14 @@ const imageState: ImageState = {
};
class AvatarEditorTest extends React.Component {
avatar: AvatarEditor;
test() {
const getImage: HTMLCanvasElement = this.avatar.getImage();
const getImageScaledToCanvas: HTMLCanvasElement = this.avatar.getImageScaledToCanvas();
const getCroppingRect: CroppedRect = this.avatar.getCroppingRect();
}
render() {
return (
<div>
@@ -37,11 +45,13 @@ class AvatarEditorTest extends React.Component {
<AvatarEditor image="" onMouseMove={event => {}} />
<AvatarEditor image="" onImageChange={() => {}} />
<AvatarEditor image="" onPositionChange={() => {}} />
<AvatarEditor
image=""
ref={ref => {
this.avatar = ref!;
}}
/>
</div>
);
}
}
const getImage: HTMLCanvasElement = AvatarEditor.getImage();
const getImageScaledToCanvas: HTMLCanvasElement = AvatarEditor.getImageScaledToCanvas();
const getCroppingRect: CroppedRect = AvatarEditor.getCroppingRect();