npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-turnstile-captcha

v1.0.6

Published

A wrapper for CloudFlare Turnstile for use in React Native apps.

Downloads

22

Readme

react-native-turnstile-captcha

A drop-in Cloudflare Turnstile component for React Native applications.

How It Works

The package uses react-native-webview as a wrapper to render the Cloudflare Turnstile widget. Then the communication between the React Native app and the widget is established by sending messages in both two-way manner.

IMPORTANT: The baseUrl value must match the hostname set in your Turnstile Widget in Cloudflare Dashboard. For example, baseUrl is set to "http://localhost" by default, so you can set the hostname for your development environment in your widget to "localhost". We recommend using a differerent widget for every hostname.

Installation

npm i react-native-turnstile-captcha react-native-webview

If you're using Expo in your project, then:

expo install react-native-webview
npm i react-native-turnstile-captcha

Usage

import { useRef } from "react";
import { ReactNativeTurnstile, ReactNativeTurnstileCaptchaHandle } from "react-native-turnstile-captcha";

// ...

// Programmatic access example:
const turnstileCaptchaRef = useRef<ReactNativeTurnstileCaptchaHandle>(null);

// Do some call to your backend and execute token validation
const result = await fetch('/path/to/some/api');
if (!result.ok) {
  throw new Error(`Token validation failed with code ${result.status}`);
  turnstileCaptchaRef.current?.sendCommand("reset");
}


function TurnstileWidget() {
  return (
    <ReactNativeTurnstileCaptcha
      ref={turnstileCaptchaRef}
      siteKey={"your-turnstile-site-key"}
      onSuccess={token => console.log(token)}
      onError={error => console.error(error)}
    />
  );
}

Turnstile tokens expire after 5 minutes and the refresh is handled automatically by Cloudfare. You can still handle the token manually by using widget commands.

Documentation

Here is the full set of arguments that ReactNativeTurnstileCaptcha takes:

| name | type | description | | ------------------ | -------------------------------------- | --------------------------------------------------------------------------- | | sitekey | string | Your Turnstile sitekey (REQUIRED) | | action? | string | - | | appearance? | string | defaults to "always" | | baseUrl? | string | Base URL (defaults to "http://localhost") | | cData? | string | - | | execution? | string | defaults to "render" | | feedbackEnabled? | boolean | defaults to true | | language? | string | defaults to "auto" | | refreshExpired? | string | defaults to "auto" | | refreshTimeout? | string | defaults to "auto" | | responseField? | boolean | controls generation of <input /> element (default true) | | responseFieldName? | string | set the name of <input /> element (default "cf-turnstile-response") | | ref? | ReactNativeTurnstileCaptchaHandle | ref to send imperative commands to Turnstile widget | | retry? | string | one of "auto", "never" (default "auto") | | retryInterval? | number | interval of retries in ms (default 8000) | | size? | string | one of "compact", "normal" (default "normal") | | style? | StyleProp<ViewStyle> | style for Turnstile wrapper container. | | theme? | string | one of "light", "dark", "auto" (default "auto") | | webViewStyle? | StyleProp<ViewStyle> | style for Turnstile wrapper (Webview). |

And the following callbacks:

| name | arguments | description | | -------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | | onSuccess | token | invoked upon success of the challenge (REQUIRED) | | onAfterInteractive? | - | invoked when challenge has left interactive mode | | onBeforeInteractive? | - | invoked before the challenge enters interactive mode | | onError? | error | invoked when there is an error, refer to Client-side errors | | onExpired? | token | invoked when the token expires and does not reset the widget | | onTimeout? | - | invoked when the challenge presents but was not solved within a given time |

For more details on what each argument does, see the Cloudflare Documentation.