import type { TextStyle, ViewStyle } from 'react-native'; import type { Theme } from '@hero-design/rn'; /** * Generates the border style for the TextInputGroup. * @param index - The index of the TextInput. * @param length - The length of the TextInputGroup. * @returns The border style for the TextInputGroup. */ const generateBorderStyle = ({ index, length, }: { index: number; length: number; }): TextStyle => { const isFirst = index === 0; const isLast = index === length - 1; if (length === 1) { return {}; } if (isFirst) { return { borderBottomLeftRadius: 0, borderBottomRightRadius: 0, }; } if (isLast) { return { borderTopLeftRadius: 0, borderTopRightRadius: 0, }; } return { borderRadius: 0, }; }; const generateMarginStyle = ({ index, length, theme, }: { index: number; length: number; theme: Theme; }): ViewStyle => { if (length === 1) { return {}; } if (index === 0) { return { marginTop: 0, }; } return { marginTop: -theme.__hd__.textInput.borderWidths.container.normal, }; }; export { generateBorderStyle, generateMarginStyle };