import { isWeb } from '@tamagui/core' ; import React from 'react' ; import { XStack } from './Stacks' ; export type GridProps = { children ? : any ; itemMinWidth ? : number ; gap ? : any ; columns ? : number ; } ; export function Grid ( { children , columns , itemMinWidth = 200 , gap } ) { if ( isWeb ) { return ( < div style = { { gap , display : 'grid' , justifyContent : 'stretch' , gridTemplateColumns : `repeat( auto-fit, minmax(${ itemMinWidth }px, 1fr) )` , } } > { children } < /div>); } const childrenList = React . Children . toArray ( children ) ; return ( < XStack alignItems = "center" justifyContent = "center" flexWrap = "wrap" > { childrenList . map ( ( child , i ) => { if ( ! child ) { return null ; } return ( < XStack key = { i } flex = { 1 } minWidth = { itemMinWidth } marginRight = { gap } marginBottom = { gap } > { child } < /XStack>); } ) } < /XStack>); }