UNPKG

react-native-input-code-otp

Version:

react-native-input-code-otp is a high-performance and fully customizable OTP input component for React Native, inspired by @shadcn/ui.

41 lines (40 loc) 935 B
"use strict"; import { forwardRef, useImperativeHandle } from 'react'; import { TextInput as RNTextInput, StyleSheet } from 'react-native'; import { useTextInputOTP } from "../hooks/use-text-input-otp.js"; import { jsx as _jsx } from "react/jsx-runtime"; export const TextInput = /*#__PURE__*/forwardRef(({ autoFocus = true, ...rest }, ref) => { const { inputRef, handleChangeText, setValue, focus, blur, clear } = useTextInputOTP(); useImperativeHandle(ref, () => ({ setValue, focus, blur, clear })); return /*#__PURE__*/_jsx(RNTextInput, { testID: "hidden-text-input", ref: inputRef, keyboardType: "number-pad", autoFocus: autoFocus, style: styles.input, ...rest, onChangeText: handleChangeText }); }); const styles = StyleSheet.create({ input: { ...StyleSheet.absoluteFillObject, opacity: 0 } }); //# sourceMappingURL=text-input.js.map