1.0.3 • Published 2 years ago

@ogzhnaydn/react-native-grid-layout v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React Native Grid Layout

This is a component for IOS and Android css grid layout. Can be installed in both Expo managed, bare and react-native cli

Installation

yarn add @ogzhnaydn/react-native-grid-layout
npm install @ogzhnaydn/react-native-grid-layout

Usage

Props

PropsRequiredDescription
bodyStylefalsestyle the image container
numColstruethe grid col count
numRowstruethe grid row count

Child Props

PropsRequiredDescription
colStarttruethe component start column number
colEndtruethe component end column number
rowStarttruethe component start row number
rowEndtruethe component end row number

Show me the code - here it is below:

import { StyleSheet, Text, View } from 'react-native';
import GridLayout from "@ogzhnaydn/react-native-grid-layout";

export default function App() {
  return (
    <View style={{flex:1}}>
        <GridLayout numCols={3} numRows={3}  bodyStyle={{ backgroundColor: "#1e232a",flex:1}}>
            <View colStart={1} colEnd={2} rowStart={1} rowEnd={1} style={{backgroundColor: "red",flex:1}}></View>
            <View colStart={3} colEnd={3} rowStart={1} rowEnd={1} style={{backgroundColor: "blue",flex:1}}></View>
            <View colStart={1} colEnd={2} rowStart={2} rowEnd={3} style={{backgroundColor: "black",flex:1}}></View>
            <View colStart={3} colEnd={3} rowStart={2} rowEnd={3} style={{backgroundColor: "white",flex:1}}></View>
        </GridLayout>
    </View>
  );
}

Contributions are welcomed, we are ready to review and merge them ASAP

Do leave a GitHub Star