All Projects → pavlelekic → react-native-gridview

pavlelekic / react-native-gridview

Licence: MIT license
A React Native component that renders a grid of items. It uses ListView under the hood.

Programming Languages

javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
python
139335 projects - #7 most used programming language
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to react-native-gridview

React Native Super Grid
Responsive Grid View for React Native
Stars: ✭ 971 (+5968.75%)
Mutual labels:  grid, listview, gridview
Superadapter
[Deprecated]. 🚀 Adapter(BaseAdapter, RecyclerView.Adapter) wrapper for Android. 一个Adapter同时适用RecyclerView、ListView、GridView等。
Stars: ✭ 638 (+3887.5%)
Mutual labels:  listview, gridview
React Native Ultimate Listview
A high performance FlatList providing customised pull-to-refresh | auto-pagination & infinite-scrolling | gridview layout | swipeable-row.
Stars: ✭ 497 (+3006.25%)
Mutual labels:  listview, gridview
Overscroll Decor
Android: iOS-like over-scrolling effect applicable over almost all scrollable Android views.
Stars: ✭ 2,671 (+16593.75%)
Mutual labels:  listview, gridview
Flutter Layouts Exampls
Layout of the flutter example.such as Row,Comlun,listview,Just for learning.
Stars: ✭ 292 (+1725%)
Mutual labels:  listview, gridview
Imageviewer
🔮图片浏览器,支持图片手势缩放、拖拽等操作,`自定义View`的模式显示,自定义图片加载方式,更加灵活,易于扩展,同时也适用于RecyclerView、ListView的横向和纵向列表模式,最低支持版本为Android 3.0及以上...
Stars: ✭ 363 (+2168.75%)
Mutual labels:  listview, gridview
Placeholderview
This library provides advance views for lists and stacks. Some of the views are build on top of RecyclerView and others are written in their own. Annotations are compiled by annotation processor to generate bind classes. DOCS -->
Stars: ✭ 2,104 (+13050%)
Mutual labels:  listview, gridview
Countdowntask
⌛️A countdown library for Android.
Stars: ✭ 64 (+300%)
Mutual labels:  listview, gridview
cgridlistctrlex
MFC Grid control using a custom draw CListCtrl with subitem editing and formatting
Stars: ✭ 80 (+400%)
Mutual labels:  grid, listview
LimberGridView
LimberGridView, a powerful JavaScript Library using Computational Geometry to render movable, dynamically resizable, and auto-arranging grids. Written in vanilla JavaScript, it can be plugged into most frameworks, plus it has a plugin for React applications. It gives users the most optimal arrangements using its highly efficient and fine-tuned a…
Stars: ✭ 51 (+218.75%)
Mutual labels:  grid, gridview
React Gridlist
A virtual-scrolling GridList component based on CSS Grids
Stars: ✭ 394 (+2362.5%)
Mutual labels:  grid, listview
android-page
android 分页列表数据加载引擎,主要封装了android分页列表数据加载的各个组件,如果你有一个需要分页加载的List列表,都可以使用此框架实现。
Stars: ✭ 15 (-6.25%)
Mutual labels:  listview, gridview
jh-weapp-demo
微信小程序项目- 实现一些常用效果、封装通用组件和工具类
Stars: ✭ 60 (+275%)
Mutual labels:  listview, gridview
Adapter
A quick adapter library for RecyclerView, GridView, ListView, ViewPager, Spinner
Stars: ✭ 376 (+2250%)
Mutual labels:  listview, gridview
flutter examples
Random flutter examples
Stars: ✭ 18 (+12.5%)
Mutual labels:  grid, gridview
React Virtualized
React components for efficiently rendering large lists and tabular data
Stars: ✭ 22,963 (+143418.75%)
Mutual labels:  grid, listview
UnityDynamicScrollView
Dynamic scrollView based on UGUI
Stars: ✭ 161 (+906.25%)
Mutual labels:  listview, gridview
tk tools
Python tkinter tools, Python3.7+
Stars: ✭ 86 (+437.5%)
Mutual labels:  grid
WechatPopupWindow
高仿微信聊天界面长按弹框样式
Stars: ✭ 71 (+343.75%)
Mutual labels:  listview
react-super-styled
Responsive JSX layouts with Styled Components
Stars: ✭ 77 (+381.25%)
Mutual labels:  grid

React Native GridView Component

Here is how it looks:

alt text

Instalation

Via NPM

npm install react-native-easy-gridview --save

Why do you need this?

If you try to make a grid view in React Native the way it is described in the docs you will encounter several problems. You need to specify exact width in pixels of your items in the grid. To do that you need to measure the available width for the whole grid, and divide that number by the number of columns you wish to have. There is no way to use percentages (they are not yet supported in RN) or flexbox to define the width of items, you have to do these calculations manually.

When you divide the available width with the number of columns, you will get a number that is most likely not a whole number, and antialiasing will kick in when rendering borders of your items. You might not care about this problem, but if you have 1px borders of your items they will not look nice and crisp.

This is why I created this component. It will fix antialiasing issues and do all these measuring and calculations for you. It uses ListView component underneath (so performance is good), and therefore accepts all the props that the original RN ListView component receives, plus one extra prop to set the number of columns (numberOfItemsPerRow).

Example

To run the example just do npm install in the /Example dir and then run react-native run-ios, or open it in Xcode and run it from there.

Or you can copy this piece of code and try it out yourself:

import React, { Component } from 'react';
import {AppRegistry, View, StyleSheet, ListView, Text} from 'react-native';
import GridView from 'react-native-easy-gridview';

const styles = StyleSheet.create({
    listContainer: {flex: 1, backgroundColor: 'powderblue'},
    item: {backgroundColor: 'navajowhite', margin: 3, paddingVertical: 7, borderWidth: 4, borderColor: 'orange', alignItems: 'center', justifyContent: 'center'}
});

const Example = React.createClass({
    getInitialState: function() {
        var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
        var data = Array.apply(null, {length: 40}).map(Number.call, Number);

        return {
            dataSource: ds.cloneWithRows(data)
        };
    },

    render: function() {
        return (
            <View style={styles.listContainer}>
                <GridView
                    dataSource={this.state.dataSource}
                    renderRow={this._renderRow}
                    numberOfItemsPerRow={5}
                    removeClippedSubviews={false}
                    initialListSize={1}
                    pageSize={5}
                />
            </View>
        );
    },

    _renderRow: function(rowData) {
        return (
            <View style={styles.item}>
                <Text>{rowData}</Text>
            </View>
        );
    }
});

Props

numberOfItemsPerRow - Like the name implies, it's the number of items per row (number of columns).

[ListView props...]

Tip: set pageSize to be the same as numberOfItemsPerRow to avoid rendering issues with ListView.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].