style overriding

    React Native 컴포넌트에서 children 스타일 덮어쓰는 방법

    export const CustomButton: FC = ({ children, ...props }) => { const childStyle = {color: '#fff'}; const childrenWithProps = React.Children.map(children, (child) => { const childProps = { ...child.props, style: StyleSheet.flatten([childStyle, child.props.style]), }; if (React.isValidElement(child)) { return React.cloneElement(child, childProps); } return child; }); return ( {childrenWithProps} );..