{"id":18578144,"url":"https://github.com/bilaleren/react-native-google-recaptcha","last_synced_at":"2025-04-10T10:31:02.508Z","repository":{"id":64385178,"uuid":"575426688","full_name":"bilaleren/react-native-google-recaptcha","owner":"bilaleren","description":"A reCAPTCHA library for React Native (Android and iOS).","archived":false,"fork":false,"pushed_at":"2025-02-17T11:46:45.000Z","size":9223,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T10:44:06.287Z","etag":null,"topics":["google-recaptcha","react-native","react-native-google-recaptcha","react-native-recaptcha"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bilaleren.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["bilaleren"]}},"created_at":"2022-12-07T13:43:19.000Z","updated_at":"2025-02-17T11:46:48.000Z","dependencies_parsed_at":"2025-03-05T04:44:11.347Z","dependency_job_id":null,"html_url":"https://github.com/bilaleren/react-native-google-recaptcha","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"c88468f6ff5ddf9265319b31fc89355464bac4ae"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bilaleren%2Freact-native-google-recaptcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bilaleren%2Freact-native-google-recaptcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bilaleren%2Freact-native-google-recaptcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bilaleren%2Freact-native-google-recaptcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bilaleren","download_url":"https://codeload.github.com/bilaleren/react-native-google-recaptcha/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199136,"owners_count":21063641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google-recaptcha","react-native","react-native-google-recaptcha","react-native-recaptcha"],"created_at":"2024-11-06T23:33:47.397Z","updated_at":"2025-04-10T10:30:57.500Z","avatar_url":"https://github.com/bilaleren.png","language":"TypeScript","funding_links":["https://github.com/sponsors/bilaleren"],"categories":[],"sub_categories":[],"readme":"# reCAPTCHA for React Native (Android and iOS)\n\n![](https://badgen.net/npm/license/react-native-google-recaptcha)\n[![](https://img.shields.io/npm/v/react-native-google-recaptcha.svg)](https://www.npmjs.com/package/react-native-google-recaptcha)\n![](https://badgen.net/packagephobia/install/react-native-google-recaptcha)\n![](https://badgen.net/bundlephobia/min/react-native-google-recaptcha)\n![](https://badgen.net/bundlephobia/minzip/react-native-google-recaptcha)\n![](https://badgen.net/npm/dw/react-native-google-recaptcha)\n![](https://badgen.net/npm/dm/react-native-google-recaptcha)\n\nA reCAPTCHA library for React Native (Android and iOS). Fully tested.\n\n---\n\nA normal widget.\n\n\u003cdetails open\u003e\n  \u003csummary\u003e\n    \u003cb\u003eNormal\u003c/b\u003e\n  \u003c/summary\u003e\n  \u003cbr /\u003e\n  \u003cimg\n    alt=\"Normal\"\n    width=\"320\"\n    height=\"540\"\n    src=\"https://raw.githubusercontent.com/bilaleren/react-native-google-recaptcha/master/screenshots/normal.gif\"\n  /\u003e\n\u003c/details\u003e\n\n---\n\nA invisible widget.\n\n\u003cdetails\u003e\n  \u003csummary\u003e\n    \u003cb\u003eInvisible\u003c/b\u003e\n  \u003c/summary\u003e\n  \u003cbr /\u003e\n  \u003cimg\n    alt=\"Normal\"\n    width=\"320\"\n    height=\"540\"\n    src=\"https://raw.githubusercontent.com/bilaleren/react-native-google-recaptcha/master/screenshots/invisible.gif\"\n  /\u003e\n\u003c/details\u003e\n\n---\n\nA compact widget.\n\n\u003cdetails\u003e\n  \u003csummary\u003e\n    \u003cb\u003eCompact\u003c/b\u003e\n  \u003c/summary\u003e\n  \u003cbr /\u003e\n  \u003cimg\n    alt=\"Normal\"\n    width=\"320\"\n    height=\"540\"\n    src=\"https://raw.githubusercontent.com/bilaleren/react-native-google-recaptcha/master/screenshots/compact.gif\"\n  /\u003e\n\u003c/details\u003e\n\n---\n\n## Install\n\n### Install the module\n\n```bash\nyarn add react-native-webview react-native-google-recaptcha\n```\n\nOr\n\n```bash\nnpm i react-native-webview react-native-google-recaptcha\n```\n\nSee the [`react-native-webview` Getting Started Guide](https://github.com/react-native-community/react-native-webview/blob/master/docs/Getting-Started.md).\n\n## Import structure\n\n```typescript\nimport GoogleRecaptcha, {\n  // Enums\n  GoogleRecaptchaSize, // Size enum: such GoogleRecaptchaSize.INVISIBLE\n  GoogleRecaptchaTheme, // Theme enum: such GoogleRecaptchaTheme.DARK\n  GoogleRecaptchaActionName, // Action name enum: such GoogleRecaptchaActionName.LOGIN\n  DEFAULT_GSTATIC_DOMAIN,\n  DEFAULT_RECAPTCHA_DOMAIN,\n  // Types (only typescript)\n  GoogleRecaptchaToken,\n  GoogleRecaptchaProps,\n  GoogleRecaptchaBaseProps,\n  GoogleRecaptchaRefAttributes\n} from 'react-native-google-recaptcha'\n```\n\n## Usage\n\nWith callback `onVerify()` method:\n\n```tsx\nimport React from 'react'\nimport { View, Button } from 'react-native'\n\nimport GoogleRecaptcha, {\n  GoogleRecaptchaToken,\n  GoogleRecaptchaRefAttributes\n} from 'react-native-google-recaptcha'\n\nconst App: React.FC = () =\u003e {\n  const recaptchaRef = React.useRef\u003cGoogleRecaptchaRefAttributes\u003e(null)\n\n  const handleSend = () =\u003e {\n    recaptchaRef.current?.open()\n  }\n\n  const handleVerify = (token: GoogleRecaptchaToken) =\u003e {\n    console.log('Recaptcha Token:', token)\n  }\n\n  const handleError = (error: unknown) =\u003e {\n    console.error('Recaptcha Error:', error)\n  }\n\n  return (\n    \u003cView\u003e\n      \u003cGoogleRecaptcha\n        ref={recaptchaRef}\n        baseUrl=\"http://localhost:3000\"\n        onError={handleError}\n        onVerify={handleVerify}\n        siteKey=\"6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI\"\n      /\u003e\n\n      \u003cButton title=\"Send\" onPress={handleSend} /\u003e\n    \u003c/View\u003e\n  )\n}\n```\n\nWith async `getToken()` method:\n\n```tsx\nimport React from 'react'\nimport { View, Button } from 'react-native'\n\nimport GoogleRecaptcha, {\n  GoogleRecaptchaSize,\n  GoogleRecaptchaToken,\n  GoogleRecaptchaRefAttributes\n} from 'react-native-google-recaptcha'\n\nconst App: React.FC = () =\u003e {\n  const recaptchaRef = React.useRef\u003cGoogleRecaptchaRefAttributes\u003e(null)\n\n  const handleSend = async () =\u003e {\n    try {\n      const token = await recaptchaRef.current?.getToken()\n\n      console.log('Recaptcha Token:', token)\n    } catch (e) {\n      console.error('Recaptcha Error:', e)\n    }\n  }\n\n  return (\n    \u003cView\u003e\n      \u003cGoogleRecaptcha\n        ref={recaptchaRef}\n        // size={GoogleRecaptchaSize.INVISIBLE}\n        baseUrl=\"http://localhost:3000\"\n        siteKey=\"6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI\"\n      /\u003e\n\n      \u003cButton title=\"Send\" onPress={handleSend} /\u003e\n    \u003c/View\u003e\n  )\n}\n```\n\nFor more details, see the [Sample Project](https://github.com/bilaleren/react-native-google-recaptcha/blob/master/Example/App.tsx).\n\n## Test\n\n**Clone**\n\n```shell\ngit clone https://github.com/bilaleren/react-native-google-recaptcha.git\n```\n\n**Then**\n\n```shell\ncd react-native-google-recaptcha \u0026\u0026 yarn install \u0026\u0026 yarn lint \u0026\u0026 yarn test\n```\n\n## Props\n\nSee prop types [GoogleRecaptchaProps](https://github.com/bilaleren/react-native-google-recaptcha/blob/master/src/GoogleRecaptcha.tsx#L48)\n\n## Methods\n\nSee method types [GoogleRecaptchaRefAttributes](https://github.com/bilaleren/react-native-google-recaptcha/blob/master/src/GoogleRecaptcha.tsx#L22)\n\nNote: If using `size=\"invisible\"`, then challenge run automatically when `open` is called.\n\n## reCAPTCHA v2 docs\n\n- [I'm not a robot](https://developers.google.com/recaptcha/docs/display)\n- [Invisible](https://developers.google.com/recaptcha/docs/invisible)\n\n## reCAPTCHA Enterprise docs\n\n- [Overview](https://cloud.google.com/recaptcha-enterprise/docs/)\n- [Using features](https://cloud.google.com/recaptcha-enterprise/docs/using-features)\n\n## License\n\nThis project is licensed under the terms of the\n[MIT license](https://github.com/bilaleren/react-native-google-recaptcha/blob/master/LICENCE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbilaleren%2Freact-native-google-recaptcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbilaleren%2Freact-native-google-recaptcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbilaleren%2Freact-native-google-recaptcha/lists"}