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.

45 lines (44 loc) 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TextInput = void 0; var _react = require("react"); var _reactNative = require("react-native"); var _useTextInputOtp = require("../hooks/use-text-input-otp.js"); var _jsxRuntime = require("react/jsx-runtime"); const TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(({ autoFocus = true, ...rest }, ref) => { const { inputRef, handleChangeText, setValue, focus, blur, clear } = (0, _useTextInputOtp.useTextInputOTP)(); (0, _react.useImperativeHandle)(ref, () => ({ setValue, focus, blur, clear })); return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, { testID: "hidden-text-input", ref: inputRef, keyboardType: "number-pad", autoFocus: autoFocus, style: styles.input, ...rest, onChangeText: handleChangeText }); }); const styles = _reactNative.StyleSheet.create({ input: { ..._reactNative.StyleSheet.absoluteFillObject, opacity: 0 } }); //# sourceMappingURL=text-input.js.map