Convert Figma logo to code with AI

GeekyAnts logoreact-native-easy-grid

Easy React Native Layout & Grid for the Dumb

2,174
169
2,174
26

Top Related Projects

Native iOS UITableView for React Native with JSON support and more

Mobile-first, accessible components for React Native & Web to build consistent UI across Android, iOS and Web.

UI Components Library for React Native

Material Design for React Native (Android & iOS)

Cross-Platform React Native UI Toolkit

:boom: React Native UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode

Quick Overview

React Native Easy Grid is a flexible and customizable grid system for React Native applications. It provides a simple way to create complex layouts using rows and columns, making it easier to design responsive user interfaces for mobile apps.

Pros

  • Easy to use and integrate into existing React Native projects
  • Flexible and customizable, allowing for complex layouts with minimal code
  • Responsive design support, adapting to different screen sizes
  • Lightweight and performant, with minimal impact on app performance

Cons

  • Limited documentation and examples for advanced use cases
  • May require additional styling for more complex designs
  • Not actively maintained, with the last update being over 2 years ago
  • Some users report issues with TypeScript support

Code Examples

  1. Basic Grid Layout:
import { Col, Row, Grid } from 'react-native-easy-grid';

const BasicLayout = () => (
  <Grid>
    <Col size={1}>
      <Text>Column 1</Text>
    </Col>
    <Col size={2}>
      <Text>Column 2</Text>
    </Col>
  </Grid>
);
  1. Nested Rows and Columns:
import { Col, Row, Grid } from 'react-native-easy-grid';

const NestedLayout = () => (
  <Grid>
    <Row>
      <Col>
        <Text>Top Left</Text>
      </Col>
      <Col>
        <Text>Top Right</Text>
      </Col>
    </Row>
    <Row>
      <Col>
        <Text>Bottom</Text>
      </Col>
    </Row>
  </Grid>
);
  1. Using Fixed and Flexible Sizes:
import { Col, Row, Grid } from 'react-native-easy-grid';

const MixedSizeLayout = () => (
  <Grid>
    <Col size={1}>
      <Text>Flexible</Text>
    </Col>
    <Col size={100}>
      <Text>Fixed 100px</Text>
    </Col>
    <Col size={2}>
      <Text>Flexible (2x)</Text>
    </Col>
  </Grid>
);

Getting Started

  1. Install the package:
npm install react-native-easy-grid
  1. Import and use in your React Native component:
import React from 'react';
import { Text } from 'react-native';
import { Col, Row, Grid } from 'react-native-easy-grid';

const MyComponent = () => (
  <Grid>
    <Row>
      <Col><Text>Hello</Text></Col>
      <Col><Text>World</Text></Col>
    </Row>
  </Grid>
);

export default MyComponent;

Competitor Comparisons

Native iOS UITableView for React Native with JSON support and more

Pros of react-native-tableview

  • Provides a native iOS TableView component, offering better performance and a more native look and feel
  • Supports advanced features like section headers, custom cell types, and indexing
  • Easier to implement complex table structures with built-in iOS-style functionality

Cons of react-native-tableview

  • Limited to iOS platform, not suitable for cross-platform development
  • Requires more setup and configuration compared to the simpler grid-based approach
  • Less flexibility in terms of custom styling and layout options

Code Comparison

react-native-tableview:

<TableView>
  <Section header="Section 1">
    <Cell cellStyle="Basic" title="Basic Cell" />
    <Cell cellStyle="Subtitle" title="Subtitle Cell" detail="Details" />
  </Section>
</TableView>

react-native-easy-grid:

<Grid>
  <Row>
    <Col><Text>Basic Cell</Text></Col>
  </Row>
  <Row>
    <Col><Text>Subtitle Cell</Text></Col>
    <Col><Text>Details</Text></Col>
  </Row>
</Grid>

The react-native-tableview code demonstrates its native iOS-style structure, while react-native-easy-grid shows a more flexible grid-based approach that can be used across platforms. The former is more suited for iOS-specific table layouts, while the latter offers a simpler, more customizable solution for general grid layouts in React Native applications.

Mobile-first, accessible components for React Native & Web to build consistent UI across Android, iOS and Web.

Pros of NativeBase

  • Comprehensive UI component library with a wide range of pre-built components
  • Customizable theme system for consistent styling across the app
  • Active development and community support

Cons of NativeBase

  • Larger bundle size due to the extensive component library
  • Steeper learning curve for developers new to the framework
  • May require additional configuration for optimal performance

Code Comparison

NativeBase:

import { Container, Header, Content, Button, Text } from 'native-base';

<Container>
  <Header />
  <Content>
    <Button><Text>Click Me</Text></Button>
  </Content>
</Container>

react-native-easy-grid:

import { Grid, Row, Col } from 'react-native-easy-grid';

<Grid>
  <Row>
    <Col><Text>Column 1</Text></Col>
    <Col><Text>Column 2</Text></Col>
  </Row>
</Grid>

Summary

NativeBase offers a more comprehensive UI toolkit with pre-built components and theming capabilities, making it suitable for rapid development of feature-rich applications. However, it comes with a larger bundle size and potential performance considerations.

react-native-easy-grid focuses specifically on providing a flexible grid system for layout management. It's lightweight and easy to use but lacks the extensive component library found in NativeBase.

Choose NativeBase for a full-featured UI framework, or react-native-easy-grid for a simple, efficient grid layout solution in React Native projects.

UI Components Library for React Native

Pros of react-native-ui-lib

  • Comprehensive UI component library with a wide range of pre-built components
  • Highly customizable and themeable, allowing for easy brand integration
  • Active development and regular updates, ensuring compatibility with the latest React Native versions

Cons of react-native-ui-lib

  • Steeper learning curve due to the extensive API and component options
  • Larger bundle size, which may impact app performance if not optimized
  • Some components may require additional setup or configuration

Code Comparison

react-native-easy-grid:

import { Col, Row, Grid } from "react-native-easy-grid";

<Grid>
  <Col size={1}><Text>Column 1</Text></Col>
  <Col size={2}><Text>Column 2</Text></Col>
</Grid>

react-native-ui-lib:

import { View, Text } from 'react-native-ui-lib';

<View row>
  <View flex={1}><Text>Column 1</Text></View>
  <View flex={2}><Text>Column 2</Text></View>
</View>

While react-native-easy-grid focuses primarily on grid layout, react-native-ui-lib offers a more comprehensive set of UI components and utilities. The code comparison shows that react-native-ui-lib uses a more native-like approach to layout, utilizing flexbox properties directly on View components.

Material Design for React Native (Android & iOS)

Pros of react-native-paper

  • Comprehensive UI component library with Material Design
  • Active development and regular updates
  • Extensive documentation and examples

Cons of react-native-paper

  • Larger bundle size due to extensive component set
  • Steeper learning curve for customization
  • May require additional setup for theming

Code Comparison

react-native-paper:

import { Button } from 'react-native-paper';

<Button mode="contained" onPress={() => console.log('Pressed')}>
  Press me
</Button>

react-native-easy-grid:

import { Col, Row, Grid } from 'react-native-easy-grid';

<Grid>
  <Col size={1}><Text>Column 1</Text></Col>
  <Col size={2}><Text>Column 2</Text></Col>
</Grid>

Summary

react-native-paper offers a comprehensive Material Design component library with active development and extensive documentation. However, it may have a larger bundle size and steeper learning curve compared to react-native-easy-grid. react-native-easy-grid focuses on simplified grid layouts, while react-native-paper provides a wide range of UI components. The choice between the two depends on project requirements, with react-native-paper being more suitable for complex UI designs and react-native-easy-grid for simpler grid-based layouts.

Cross-Platform React Native UI Toolkit

Pros of react-native-elements

  • Comprehensive UI toolkit with a wide range of pre-built components
  • Active community and frequent updates
  • Customizable themes and styles for consistent design

Cons of react-native-elements

  • Larger bundle size due to the extensive component library
  • Steeper learning curve for beginners
  • May require additional configuration for optimal performance

Code Comparison

react-native-elements:

import { Button, Card, Icon } from 'react-native-elements';

<Card>
  <Card.Title>Card Title</Card.Title>
  <Card.Divider/>
  <Button
    icon={<Icon name='code' color='#ffffff' />}
    buttonStyle={{borderRadius: 0, marginLeft: 0, marginRight: 0, marginBottom: 0}}
    title='VIEW NOW' />
</Card>

react-native-easy-grid:

import { Col, Row, Grid } from 'react-native-easy-grid';

<Grid>
  <Col size={1}><Text>Column 1</Text></Col>
  <Col size={2}><Text>Column 2</Text></Col>
  <Col size={1}><Text>Column 3</Text></Col>
</Grid>

react-native-elements provides a more comprehensive set of UI components, while react-native-easy-grid focuses specifically on layout management using a grid system. The choice between the two depends on the project's specific needs and the developer's preference for either a full UI toolkit or a dedicated layout solution.

:boom: React Native UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode

Pros of react-native-ui-kitten

  • Comprehensive UI component library with a wide range of pre-built elements
  • Customizable theming system for easy styling and branding
  • Active development and regular updates

Cons of react-native-ui-kitten

  • Steeper learning curve due to its extensive feature set
  • Larger bundle size compared to lightweight alternatives
  • May require more setup and configuration

Code Comparison

react-native-ui-kitten:

import { Button, Layout, Text } from '@ui-kitten/components';

const HomeScreen = () => (
  <Layout style={styles.container}>
    <Text category='h1'>Welcome to UI Kitten</Text>
    <Button>BUTTON</Button>
  </Layout>
);

react-native-easy-grid:

import { Grid, Row, Col } from 'react-native-easy-grid';

const HomeScreen = () => (
  <Grid>
    <Row>
      <Col><Text>Welcome</Text></Col>
    </Row>
    <Row><Button title="BUTTON" /></Row>
  </Grid>
);

react-native-ui-kitten offers a more comprehensive set of UI components and theming options, while react-native-easy-grid focuses primarily on layout management using a grid system. The choice between the two depends on project requirements, with UI Kitten being more suitable for complex UI designs and Easy Grid for simpler, grid-based layouts.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

React Native Easy Grid 🐵

Master Build Status

This is NOT-JUST-ANOTHER-GRID-LAYOUT library! We are trying to simplify flexbox with easier approach.

Installation

npm install react-native-easy-grid --save

Usage

Include the components

import { Col, Row, Grid } from "react-native-easy-grid";

1. Two columns (50% and 50%)

<Grid>
    <Col></Col>
    <Col></Col>
</Grid>

col-50-50

Note: If you don't assign the size property, it defaults to equal width (or height) with its siblings

2. Two rows

<Grid>
    <Row></Row>
    <Row></Row>
</Grid>

row-50-50

3. Two rows (75% and 25%)

<Grid>
    <Row size={75}></Row>
    <Row size={25}></Row>
</Grid>

This is exactly same as

<Grid>
    <Row size={3}></Row>
    <Row size={1}></Row>
</Grid>

row-75-25

Same concept applies to <Col />

4. Three columns (33.33% each)

<Grid>
    <Col></Col>
    <Col></Col>
    <Col></Col>
</Grid>

col-33-33-33

5. Three rows (50%, 25% and 25%)

<Grid>
    <Row size={2}></Row>
    <Row size={1}></Row>
    <Row size={1}></Row>
</Grid>

row-50-25-25

6. Nested Layout or Grid

1 2
3
<Grid>
    <Col>
        <Text>1</Text>
    </Col>
    <Col>
        <Row>
            <Text>2</Text>
        </Row>
        <Row>
            <Text>3</Text>
        </Row>
    </Col>
</Grid>

complex

7. Fixed width and fluid width combination

<Grid>
    <Col style={{ width: 40 }}>
        <Text>Fixed width</Text>
    </Col>
    <Col>
        <Text>Fluid width</Text>
    </Col>
</Grid>

col-fluid-fixed.png

8. Fixed height and fluid height combination

<Grid>
    <Row style={{ height: 40 }}>
        <Text>Fixed width</Text>
    </Row>
    <Row>
        <Text>Fluid width</Text>
    </Row>
</Grid>

Do you think anything could be simpler than that? This repo is part of our bigger project called NativeBase.io. Do check that!

Important note about usage with <ScrollView />

Note: If you're using <Row /> inside a <ScrollView />, the height of the component would be flexible according to the content, though you can always apply the height styling.

NPM DownloadsLast 30 Days