t49tran / react-google-recaptcha-v3

Google Recaptcha V3 integration for React
MIT License
427 stars 91 forks source link

Add custom inline-badge #118

Closed ramirezcgn closed 1 year ago

ramirezcgn commented 2 years ago

Fix #94

t49tran commented 2 years ago

Hi @ramirezcgn , thanks for this, could you please add this feature to ReadMe ?

ramirezcgn commented 2 years ago

Hi @ramirezcgn , thanks for this, could you please add this feature to ReadMe ?

Hi, I already added the options to the readme, do you want anything else?

WilliamPriorielloGarda commented 2 years ago

This would be good for us if added to npm also

DiFuks commented 2 years ago

Now this code does not work correctly. When changing the theme or locale, an error appears: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. At the same time, without inlideBadgeId, the locale change works, but the theme (as expected) does not

  const { i18n } = useTranslation();
  const { theme } = useTheme();

  return (
    <GoogleReCaptchaProvider
      reCaptchaKey={process.env.GOOGLE_RECAPTCHA_CLIENT_KEY as string}
      language={i18n.language}
      inlineBadgeId='google-badge'
      parameters={{
        theme,
      }}
    >
      {children}
      <div id='google-badge' />
    </GoogleReCaptchaProviderBase>
 )
DiFuks commented 2 years ago

Hello! I sent you a PR on my comments. Please take a look. I think this is a better solution https://github.com/ramirezcgn/react-google-recaptcha-v3/pull/4

ramirezcgn commented 2 years ago

Hello! I sent you a PR on my comments. Please take a look. I think this is a better solution ramirezcgn#4

Hello, I left you a comment, the rest is fine with me

DiFuks commented 2 years ago

Super! Now it remains to wait for @t49tran

ramirezcgn commented 2 years ago

Super! Now it remains to wait for @t49tran

there is an issue with one "any" cast you added, it's blocking the merge

DiFuks commented 2 years ago

It's strange that there are no errors for other "as any". Can you fix it? Or me?

ramirezcgn commented 2 years ago

It's strange that there are no errors for other "as any". Can you fix it? Or me?

add / eslint-disable-next-line @typescript-eslint/no-explicit-any /

DiFuks commented 2 years ago

Ok. https://github.com/ramirezcgn/react-google-recaptcha-v3/pull/5