WARNING!! THIS LIB IS UNDER DEVELOPMENT!! DON'T USE IT IN AMBIENT PRODUCTION!
This is a small and easy grid layout for the react-native-paper library UI. The idea is to make the components more easier to position.
npm install react-native-paper-grid --save
import { Col, Row, Grid } from "react-native-paper-grid";
<Grid>
<Row>
<Col></Col>
</Row>
</Grid>
For default all components will be stretched to width of the . If you don't want this use the 'inline' prop
<Grid>
<Row>
<Col></Col>
<Col></Col>
</Row>
</Grid>
Note: If you don't assign the size property, it defaults to equal width with its siblings
<Grid>
<Row>
<Col></Col>
<Col></Col>
<Col></Col>
</Row>
</Grid>
<Grid>
<Row>
<Col></Col>
</Row>
<Row>
<Col></Col>
</Row>
</Grid>
<Grid>
<Row>
<Col size={75}></Col>
<Col size={25}></Col>
</Row>
</Grid>
This is exactly same as
<Grid>
<Row>
<Col size={3}></Col>
<Col size={1}></Col>
</Row>
</Grid>
Same concept applies to
<Col />
<Grid>
<Row>
<Col inline>
<RadioButton
value="first"
status={'unchecked' }
onPress={() => {}}
/>
<Text>Radio Button 1</Text>
</Col>
<Col inline>
<RadioButton
value="second"
status={'unchecked' }
onPress={() => {}}
/>
<Text>Radio Button 2</Text>
</Col>
</Row>
</Grid>
<Grid>
<Row>
<Col>
<Row nopad>
<Col inline nopad>
<Checkbox
status={'unchecked'}
onPress={() => {}}
/>
<Text>Checkbox 1</Text>
</Col>
</Row>
<Row nopad>
<Col inline nopad>
<Checkbox
status={'unchecked'}
onPress={() => {}}
/>
<Text>Checkbox 2</Text>
</Col>
</Row>
</Col>
<Col>
<Row nopad>
<Col inline nopad>
<Checkbox
status={'unchecked'}
onPress={() => {}}
/>
<Text>Checkbox 1</Text>
</Col>
</Row>
<Row nopad>
<Col inline nopad>
<Checkbox
status={'unchecked'}
onPress={() => {}}
/>
<Text>Checkbox 2</Text>
</Col>
</Row>
</Col>
</Row>
</Grid>
'nopad' prop is to be used when you don't need the internal padding of the or
<Grid>
<Row>
<Col width={60}>
<Text>Fixed width</Text>
</Col>
<Col>
<Text>Fluid width</Text>
</Col>
</Row>
</Grid>