Skip to main content
Version: 1.0.0

Grid

Grid component render a container that can resize automatically on the basis of provided props.

Example banner Example banner

Implementation code

import { Grid, StyledText } from 'rn-nativeflow';

const Component = () => {
return (
<Grid container>
<Grid item justifyContent='center' alignItems='center' containerStyle={{ backgroundColor: 'green', height: 100}} xs={4} md={12} >
<StyledText>Item 1 xs={4}</StyledText>
</Grid>
<Grid item justifyContent='center' alignItems='center' containerStyle={{ backgroundColor: 'gray', height: 100 }} xs={4} md={6} >
<StyledText >Item 2 xs={4}</StyledText>
</Grid>
<Grid item justifyContent='center' alignItems='center' containerStyle={{ backgroundColor: 'blue', height: 100 }} xs={4} md={6}>
<StyledText >Item 3 xs={4}</StyledText>
</Grid>
<Grid item justifyContent='center' alignItems='center' containerStyle={{ backgroundColor: 'red', height: 100 }} xs={12} md={6} >
<StyledText >Item 4 xs={12}</StyledText>
</Grid>
</Grid>
);
}
export default Component;

Props

PropTypeDefaultDescription
containerbooleanfalse
itembooleanfalse
spacingnumber0Overall spacing between items
spacingHnumber0Horizontal spacing between items
spacingVnumber0Vertical spacing between items
xsnumber12item size on xs devices and above
smnumber0item size on sm devices and above
mdnumber0item size on md devices and above
lgnumber0item size on lg devices and above
xlnumber0item size on xl devices and above
containerStyleobjectHelps to change the styles of the container or item

Grid screen sizes

sizevalue
xm0 and above
sm360 and above
md600 and above
lg768 and above
xl960 and above