react-google-recaptcha icon indicating copy to clipboard operation
react-google-recaptcha copied to clipboard

Suggest Idea: Event handle for async load

Open alienriquebm opened this issue 8 years ago • 1 comments

Hi, thanks a lot for your work on this. I just have a suggest, maybe add a event to handle when the captcha script loads correctly or/and a timeout (in case of internet problems)

<ReCAPTCHA
     ref="recaptcha"
     sitekey="6LcYNzMUAAAAAOgeebqBLFCOIFSKmCsSTkSUNwWk"
     onLoad={this.handleOnLoad}
     onTimeout={this.handleTimeout}
     onChange={this.onCaptcha}
/>

alienriquebm avatar Oct 05 '17 18:10 alienriquebm

So, it's not documented directly on the ReCAPTCHA but since the component is wrapped in react-async-script you should be able to pass asyncScriptOnLoad for the onload.

I can try getting a fix in for the timeout, but if you need the feature right now I would advise you to go ahead open a pr on https://github.com/dozoisch/react-async-script to ahead the parameter! Something like asyncScriptOnTimeout

dozoisch avatar Oct 05 '17 20:10 dozoisch