1.2.2 • Published 9 months ago

@adrianso/react-native-recaptchav3 v1.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

react-native-recaptchav3

npm npm

React native component to use the invisible reCAPTCHA v3 from Google

https://www.google.com/recaptcha/intro/v3.html

Installation

npm install --save @adrianso/react-native-recaptchav3

or

yarn add @adrianso/react-native-recaptchav3

Note: React Native Community Webview requires you to link the native dependencies (https://github.com/react-native-community/react-native-webview/blob/master/docs/Getting-Started.md)

Demo

automatic retrybutton

Usage

Automatically get a captcha token:

import ReCaptchaV3 from '@adrianso/react-native-recaptchav3'

<ReCaptchaV3
  captchaDomain={'https://yourowndomainname.co.nz'}
  siteKey={'yourownsitekey'}
  onReceiveToken={(token: string) => Alert.alert('CAPTCHA', token)}/>

One could also use a trigger to request a new token using the reference of the component:

import ReCaptchaV3 from '@adrianso/react-native-recaptchav3'

<ReCaptchaV3
  ref={(ref: RecaptchaV3) => this._captchaRef = ref}
  captchaDomain={'https://yourowndomainname.co.nz'}
  siteKey={'yourownsitekey'}
  onReceiveToken={(token: string) => Alert.alert('CAPTCHA', token)}/>

<TouchableOpacity onPress={() => this._captchaRef.refreshToken()}>
  <Text>Retry</Text>
</TouchableOpacity>

Options

KeyDescriptionDefaultRequiredType
captchaDomainYour url registered with Google reCAPTCHANonetruestring
onReceiveTokenThe callback used to get the captcha token from the componentNonetrue(captchaToken: string) => void
siteKeyThe site key provided by Google reCAPTCHANonetruestring

Changelog

Contributing

Pull requests are welcome.

License

1.2.2

9 months ago