@@ -33,29 +33,29 @@ export class SignatureCanvas extends Component<SignatureCanvasProps> {
33
33
_sigPad : SignaturePad = { } as SignaturePad
34
34
_canvas : HTMLCanvasElement = { } as HTMLCanvasElement
35
35
36
- private readonly setRef = ( ref : HTMLCanvasElement | null ) => {
36
+ private readonly setRef = ( ref : HTMLCanvasElement | null ) : void => {
37
37
if ( ref ) {
38
38
this . _canvas = ref
39
39
}
40
40
}
41
41
42
- _excludeOurProps = ( ) => {
42
+ _excludeOurProps = ( ) : SignaturePad . SignaturePadOptions => {
43
43
const { canvasProps, clearOnResize, ...sigPadProps } = this . props
44
44
return sigPadProps
45
45
}
46
46
47
- componentDidMount ( ) {
47
+ componentDidMount : Component [ 'componentDidMount' ] = ( ) => {
48
48
this . _sigPad = new SignaturePad ( this . _canvas , this . _excludeOurProps ( ) )
49
49
this . _resizeCanvas ( )
50
50
this . on ( )
51
51
}
52
52
53
- componentWillUnmount ( ) {
53
+ componentWillUnmount : Component [ 'componentWillUnmount' ] = ( ) => {
54
54
this . off ( )
55
55
}
56
56
57
57
// propagate prop updates to SignaturePad
58
- componentDidUpdate ( ) {
58
+ componentDidUpdate : Component [ 'componentDidUpdate' ] = ( ) => {
59
59
Object . assign ( this . _sigPad , this . _excludeOurProps ( ) )
60
60
}
61
61
@@ -80,14 +80,14 @@ export class SignatureCanvas extends Component<SignatureCanvasProps> {
80
80
return this . _sigPad
81
81
}
82
82
83
- _checkClearOnResize = ( ) => {
83
+ _checkClearOnResize = ( ) : void => {
84
84
if ( ! this . props . clearOnResize ) {
85
85
return
86
86
}
87
87
this . _resizeCanvas ( )
88
88
}
89
89
90
- _resizeCanvas = ( ) => {
90
+ _resizeCanvas = ( ) : void => {
91
91
const canvasProps = this . props . canvasProps || { }
92
92
const { width, height } = canvasProps
93
93
// don't resize if the canvas has fixed width and height
@@ -111,7 +111,7 @@ export class SignatureCanvas extends Component<SignatureCanvasProps> {
111
111
this . clear ( )
112
112
}
113
113
114
- render ( ) {
114
+ render : Component [ 'render' ] = ( ) => {
115
115
const { canvasProps } = this . props
116
116
return < canvas ref = { this . setRef } { ...canvasProps } />
117
117
}
0 commit comments