mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #24241 from gabsprates/react-avatar-editor_bugfix
fix react-avatar-editor methods
This commit is contained in:
Vendored
+4
-3
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user