react-native-google-recaptcha-v2
Implement Google recaptcha v2 in React Native (both Android an iOS)
Add it to your project
- Insall package
- Using NPM
npm install react-native-google-recaptcha-v2
- Using Yarn
yarn add react-native-google-recaptcha-v2
- Import package
import ConfirmGoogleCaptcha from 'react-native-google-recaptcha-v2';
Dependencies
Usage
Snack link
Check demo in;;const siteKey = 'you_site_key';const baseUrl = 'base_url';Component { if event && eventnativeEventdata if 'cancel' 'error' 'expired' thiscaptchaForm; return; else console; ; }; { return <View style=stylescontainer> <ConfirmGoogleCaptcha ref= thiscaptchaForm = _ref siteKey=siteKey baseUrl=baseUrl languageCode='en' onMessage=thisonMessage /> <Button onPress= { thiscaptchaForm; } title='Click' style= width: 120 backgroundColor: 'darkviolet' textColor='#fff' /> </View> ; }
Note
You can import GoogleReCaptcha from 'react-native-google-recaptcha-v2/GoogleReCaptcha';
to customize UI by yourself
DEMO
iOS
Android
Props
siteKey
(String) - The site key of the Google Recaptcha.baseUrl
(String) The url domain defined on your Google Recaptcha.onMessage
(Function) - The callback function after received response, error of Google captcha or when user cancellanguageCode
(String) - Language to be display of captcha form. Can be found at this linkcancelButtonText
(String) - Title of cancel button.
MIT Licensed