import React, { useMemo } from 'react'; import { Pressable, View } from 'react-native'; import type { SpaceProps } from './type'; import { flexAlign, flexJustify } from './style'; const Space = (props: SpaceProps): JSX.Element => { const { children, divider, direction = 'horizontal', wrap, align, justify, gap = 8, ...rest } = props; const childList = useMemo( // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore () => React.Children.map(children, c => c).filter(c => c !== null && c !== undefined), [children] ); return ( {childList.map((child, idx) => ( // eslint-disable-next-line react/no-array-index-key 0 && { marginLeft: gap }}>{child} {!!divider && idx !== childList.length - 1 && {divider}} ))} ); }; export default Space;