react-native-input-code
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

react-native-input-code

A passcode input field for React Native.

Installation

yarn add react-native-input-code

Usage

import InputCode from 'react-native-input-code';

type Props = {};
export default class App extends Component<Props> {
  onFullFill = (code: string) => {
    console.log(code);
    this.inputCode.reset();
  };

  render() {
    return (
      <View style={styles.container}>
        <InputCode
          ref={ref => (this.inputCode = ref)}
          length={4}
          onFullFill={this.onFullFill}
          passcode
          codeContainerStyle={{
            borderWidth: 0,
            borderBottomWidth: 2,
          }}
          codeContainerCaretStyle={{
            borderWidth: 0,
            borderBottomWidth: 2,
            borderBottomColor: 'red',
          }}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'stretch',
  },
});

Package Sidebar

Install

npm i react-native-input-code@0.0.9

Version

0.0.9

License

MIT

Unpacked Size

13.5 kB

Total Files

6

Last publish

Collaborators

  • sfjwr