You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-native-simple-text-captcha

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-simple-text-captcha

Create and validate text captcha in React Native app

0.1.0
latest
Source
npmnpm
Version published
Weekly downloads
8
33.33%
Maintainers
0
Weekly downloads
 
Created
Source

react-native-simple-text-captcha

Create and validate text captcha in React Native app

Installation

npm install react-native-simple-text-captcha
yarn add react-native-simple-text-captcha

Screenshots

Usage

Import
import type { CaptchaRef } from 'react-native-simple-text-captcha';
import Captcha from 'react-native-simple-text-captcha';
State and Ref
const captchaRef = useRef < CaptchaRef > null;

const [captcha, setCaptcha] = useState('');
const [validateResult, setValidateResult] = useState('');
Validation logic
const validateCaptcha = () => {
  const check = captchaRef.current?.validateCaptcha(captcha);
  if (check) {
    setValidateResult('Captcha Corrected');
  } else {
    setValidateResult('Captcha Incorrect');
  }
};
Component
<Captcha ref={captchaRef} />

<TextInput
  style={styles.input}
  value={captcha}
  onChangeText={setCaptcha}
  cursorColor={'#333'}
  placeholder="OTP"
/>

<Text>{validateResult}</Text>

<TouchableOpacity style={styles.button} onPress={validateCaptcha}>
  <Text style={styles.buttonText}>Validate</Text>
</TouchableOpacity>

Props

NameTypeDefault
captchaLengthnumber6
backgroundstringwhite
textColorstringblack
refreshIconReactNode
captchaWrapperStyleViewStylenone

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Made with create-react-native-library

Keywords

react-native

FAQs

Package last updated on 16 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.