Recibo el método onErrored directamente desde la carga de la página en Android e iOS.
Funciona bien en PC/Mac.
Tener react-google-recaptcha v2.1.0
¿Estoy haciendo algo mal?
Configuración de la referencia:
constructor(props) { super(props); this.captchaRef = React.createRef(); }En error:
handleCaptchaError = (event) => { console.log("handleCaptchaError", { event }); };Al enviar:
handleSubmit = async (form) => { form.preventDefault(); this.captchaRef.current.reset(); const token = await this.captchaRef.current.executeAsync(); const { email, password } = form.target.elements; if (this.handleEmail(email.value) && this.handlePassword(password.value)) { this.props.dispatch( authorize({ email: email.value, password: password.value, captcha: token, }) ); } };La forma:
render() { return ( <React.Fragment> <Form onSubmit={this.handleSubmit}> <List> <ItemInput> <Input type="email" name="email" autoComplete="username" onChange={(e) => this.handleEmail(e.target.value)} ></Input> </ItemInput> <ItemInput> <Input type="password" name="password" autoComplete="current-password" onChange={(e) => this.handlePassword(e.target.value)} ></Input> </ItemInput> <Button>Submit</Button> </List> </Form> <div style={{ position: "absolute", visibility: "hidden", opacity: "0", pointerEvents: "auto", }} > <ReCAPTCHA ref={this.captchaRef} size="invisible" sitekey={global.config.captcha.key} data-callback="callback" onErrored={(e) => this.handleCaptchaError(e)} //onExpired={} /> </div> </React.Fragment> ); } }