mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
at thread-bug 1.4 kB view raw
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 ...(Array.isArray(child.props?.style) 27 ? child.props.style 28 : [child.props.style || {}]), 29 { 30 borderTopLeftRadius: i > 0 ? 0 : undefined, 31 borderTopRightRadius: i > 0 ? 0 : undefined, 32 borderBottomLeftRadius: i < total - 1 ? 0 : undefined, 33 borderBottomRightRadius: i < total - 1 ? 0 : undefined, 34 borderBottomWidth: i < total - 1 ? 0 : undefined, 35 }, 36 ], 37 })} 38 </React.Fragment> 39 ) : null 40 })} 41 </View> 42 ) 43}