JSPM

rn-recaptcha

0.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q30548F
  • License MIT

this is the react native component fore google recaptcha v2

Package Exports

  • rn-recaptcha

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rn-recaptcha) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

rn-recaptcha

this is the React native component for Google Recaptch V2

How to install

 yarn add rn-recaptcha
 npm install rn-recaptcha

How to use

you can clone this project and check the App.js for see How to use it. or just like this.

import React, {Component} from 'react';
import {StyleSheet, View} from 'react-native';
import RNRecaptcha from 'RNRecaptcha';

export default class App extends Component<Props> {
  render() {
    return (
      <View style={styles.container}>
        <RNRecaptcha siteKey={siteKey} onMessage={onMessage} url={testUrl}/>
      </View>
    );
  }
}

const siteKey='6LcWuG4UAAAAAAn1v2RHkpyaE6yaXAc-uyRDSgMG';
const testUrl = 'https://rnrecaptcha.org';

onMessage = event => {
  if ( event && event.nativeEvent.data) {
    console.log(event.nativeEvent.data)
  } else if(event.nativeEvent.data === 'expired'){
    console.log('this is when you expired')
  }else if(event.nativeEvent.data === 'error') {
    console.log('this is when error')
  } else {
    console.log('other')
  }
};


const styles = StyleSheet.create({
  container: {
    flex: 1,
    paddingTop: 20
  },
});

siteKey is the siteKey of the Google Recaptcha

testUrl is the url Domain defined on your google Recaptcha

onMessage is the callback function which will be called after the google verification.

Demo

there is RN Project Demo you can check: Demo

Any Suggestion or Questions, please contact me.