import React, { Children } from 'react'; import { View } from 'react-native'; import type { RowProps } from 'src/theme/themeTypes'; import createViewStyle from 'src/themeUtils/createViewStyle'; import type themeType from '../theme/theme'; function createRow(useTheme: () => T) { const Row = ({ children, spacing, view = {}, ...otherProps }: RowProps) => { const theme = useTheme(); const { flexDirection = 'row' } = otherProps; let childElements = Children.map(children, (child) => child); if (spacing) { childElements = childElements?.map((each, eachIndex) => { const isLastElement = eachIndex === (childElements?.length ?? 0) - 1; return ( {each} ); }); } return ( {childElements} ); }; return Row; } export default createRow;