mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import React from 'react' 2import {View} from 'react-native' 3 4import {atoms, useTheme} from '#/alf' 5 6/** 7 * NOT FINISHED, just here as a reference 8 */ 9export function InputGroup(props: React.PropsWithChildren<{}>) { 10 const t = useTheme() 11 const children = React.Children.toArray(props.children) 12 const total = children.length 13 return ( 14 <View style={[atoms.w_full]}> 15 {children.map((child, i) => { 16 return React.isValidElement(child) ? ( 17 <React.Fragment key={i}> 18 {i > 0 ? ( 19 <View 20 style={[atoms.border_b, {borderColor: t.palette.contrast_500}]} 21 /> 22 ) : null} 23 {React.cloneElement(child, { 24 // @ts-ignore 25 style: [ 26 // @ts-ignore 27 ...(Array.isArray(child.props?.style) 28 ? // @ts-ignore 29 child.props.style 30 : // @ts-ignore 31 [child.props.style || {}]), 32 { 33 borderTopLeftRadius: i > 0 ? 0 : undefined, 34 borderTopRightRadius: i > 0 ? 0 : undefined, 35 borderBottomLeftRadius: i < total - 1 ? 0 : undefined, 36 borderBottomRightRadius: i < total - 1 ? 0 : undefined, 37 borderBottomWidth: i < total - 1 ? 0 : undefined, 38 }, 39 ], 40 })} 41 </React.Fragment> 42 ) : null 43 })} 44 </View> 45 ) 46}