@darkas20/rn-code-field

1.0.0 • Public • Published

react-native-confirmation-code-field

npm Travis

A react-native confirmation code field for both IOS and Android (base on this project Migration Guide)

Component features:

  • 🔮 Simple. Easy to use.
  • 🍎 IOS "fast paste SMS-code" support.
  • 🚮 Clearing part of the code by clicking on the cell
  • 🛠 Extendable and hackable.
  • 🤓 Readable changelog.

Links

Screenshots

Install

yarn add react-native-confirmation-code-field
# or
npm install react-native-confirmation-code-field

Usage

import React, { Component } from 'react';
import CodeInput from 'react-native-confirmation-code-field';

class App extends Component {
  handlerOnFulfill = code => console.log(code);

  render() {
    return <CodeInput onFulfill={this.handlerOnFulfill} />;
  }
}

How it works?

This component consists of:

  1. Container <View {...containerProps}/>;
  2. Render the "Cells" for the text code inside the container ("Cells" is <TextInput {...cellProps} />);
  3. And over this render invisible <TextInput {...inputProps}/>;
  4. "Cursor" inside cell is simulated component

Package Sidebar

Install

npm i @darkas20/rn-code-field

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

24.9 kB

Total Files

16

Last publish

Collaborators

  • darkas20