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.
25 lines (24 loc) • 760 B
JavaScript
import { Children, cloneElement, isValidElement } from 'react';
import { View, StyleSheet } from 'react-native';
import { jsx as _jsx } from "react/jsx-runtime";
export function TextInputOTPGroup({
groupStyles,
children
}) {
const slots = Children.toArray(children).filter(child => /*#__PURE__*/isValidElement(child));
return /*#__PURE__*/_jsx(View, {
style: StyleSheet.flatten([styles.inputGroup, groupStyles]),
children: slots.map((child, index) => /*#__PURE__*/cloneElement(child, {
isFirst: index === 0,
isLast: index === slots.length - 1
}))
});
}
const styles = StyleSheet.create({
inputGroup: {
flexDirection: 'row',
alignItems: 'center'
}
});
//# sourceMappingURL=text-input-otp-group.js.map
;