React Native Table Component by Elara
This is a table component for react native.
Original library react-native-table-component from Gil2015, modified to add events to the touch cells
Installation
npm install react-native-table-component-elara
Examples will be tested and added soon.
USE:
import Table TableWrapper Row Rows Col Cols Cell from 'react-native-table-component';
Changelogs
- [v1.0.3]
- 'TableWraper' changed to 'TableWrapper';
- [v1.1.1]
- Data supports incoming Element types;
- Data supports incoming Element types;
Examples
Example1

import React Component from "react";import View StyleSheet from "react-native";import Table TouchableCell TableWrapper TouchableRow Row Rows Col Cols Cell from 'react-native-table-component'; { const tableHead = 'Head' 'Head2' 'Head3' 'Head4'; const tableData = '1' '2' '3' '4' 'a' 'b' 'c' 'd' ; return <View> <Table> <Row = = =/> <Rows = = =/> </Table> </View> } const styles = StyleSheet
Example2

import React Component from "react";import View StyleSheet from "react-native";import Table TableWrapper Row Rows Col Cols Cell from 'react-native-table-component'; { const tableHead = 'Head' 'Head2' 'Head3' 'Head4'; const tableData = '1' 'a' '2' 'b' '3' 'c' '4' 'd' return <View> <Table = => <Row = = = =/> <Cols = = = =/> </Table> </View> } const styles = StyleSheet
Example3

import React Component from "react";import View StyleSheet from "react-native";import Table TableWrapper Row Rows Col Cols Cell from 'react-native-table-component'; { const tableHead = 'Head' 'Head2' 'Head3' 'Head4'; const tableTitle = 'Title' 'Title2'; const tableData = '' '' '' '' '' '' ; return <View> <Table> <Row = = = =/> <TableWrapper => <Col = = = =/> <Rows = = =/> </TableWrapper> </Table> </View> } const styles = StyleSheet
Example4

import React Component from "react";import View StyleSheet from "react-native";import Table TableWrapper Row Rows Col Cols Cell from 'react-native-table-component'; { const tableData = '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' return <View> <Table => /* Left Wrapper */ <TableWrapper => <Cell ="Head" =/> <TableWrapper => <Col = = =/> <Col = = = =></Col> </TableWrapper> </TableWrapper> /* Right Wrapper */ <TableWrapper => <Rows = =/> </TableWrapper> </Table> </View> } const styles = StyleSheet;
Example5

import React Component from "react";import View StyleSheet ScrollView from "react-native";import Table TableWrapper Row Rows Col Cols Cell from 'react-native-table-component'; { const tableHead = 'Head2' 'Head3' 'Head4' 'Head5' 'Head6' 'Head7' 'Head8' 'Head9' 'Head10''Head11'; const tableTitle = 'Title' 'Title2' 'Tilte3' 'Title4' 'Title5'; const tableData = 1 2 3 4 5 6 7 8 9 10 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 1 2 3 4 5 6 7 8 9 10 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 1 2 3 4 5 6 7 8 9 10 ; const widthArr = 60 60 60 60 60 60 60 60 60 60; return <View> <Table => /* Left Wrapper */ <TableWrapper => <Cell ="Head" = =/> tableTitle </TableWrapper> /* Right scrollview Wrapper */ <ScrollView => /* If parent element is not table element, you should add the type of borderstyle. */ <TableWrapper => <Row = = = =/> tableData </TableWrapper> </ScrollView> </Table> </View> } const styles = StyleSheet
Example6

import React Component from 'react';import Alert StyleSheet Text View TouchableOpacity from 'react-native';import Table TableWrapper Row Rows Col Cols Cell from 'react-native-table-component'; { Alert; } { const ele = value <TouchableOpacity => <View => <Text =>button</Text> </View> </TouchableOpacity> ; const tableData = '1' '2' '3' 'a' 'b' 'c' '1' '2' '3' 'a' 'b' 'c' ; return <View> <Table> <Rows = = =/> </Table> </View> } const styles = StyleSheet;
Properties
Prop | Type | Description | Default |
---|---|---|---|
data | Array | Table data. | null |
style | Style | Container style. | null |
borderStyle | Object | Table border line width and color. | { borderWidth: 1, borderColor: #000 } |
textStyle | Style | Cell font style. | null |
flexArr | Array | Flex value per column. | [] |
widthArr | Array | Width per column. | [] |
heightArr | Array | Height per line. | [] |