agilgur5 / react-signature-canvas

A React wrapper component around signature_pad (in < 150 LoC). Unopinionated and heavily updated fork of react-signature-pad
https://agilgur5.github.io/react-signature-canvas/
Other
546 stars 119 forks source link

`TypeError: Cannot read property 'off' of null` #39

Closed Naghal closed 4 years ago

Naghal commented 4 years ago

Selection_815 Hi! Following the installation of your package, I am getting the error "TypeError: Cannot read property 'off' of null". Here is a minimal code to reproduce:

import React from 'react';
import SignaturePad from 'react-signature-canvas';

const TOKEN_PARAM = 'token';
class ConsentForm extends React.Component{

    constructor(props) {
        super(props);
    }

    render() {
        return (
            <SignaturePad />
        );
    }
}
export default ConsentForm;

I am using Chrome and react-signature-canvas 1.0.3. Also, It does the same error if I copy the code in your codepen.

agilgur5 commented 4 years ago

Here is a minimal code to reproduce:

Sorry, this is not a reproduction, this code does not call the off function or even create a ref in order to do so. It is not minimal either, there's an unused TOKEN_PARAM variable, it's not rendered to DOM here, this is not standalone, etc.

Also, It does the same error if I copy the code in your codepen.

Again, this is not a reproduction nor standalone or minimal, so this cannot just be copied, but with some modifications to make it so, this code does indeed run in the CodeSandbox:

Screen Shot 2020-01-21 at 4 22 15 PM

You'll have to provide an actual, minimal reproduction or demo displaying this behavior, such as:

Can re-open and analyze the issue once I can reproduce it.