HomeOur TeamContact

Standard Table

By Utkarsh Lubal
Published in Tables
June 15, 2022
1 min read
Standard Table

Table Of Contents

01
Introduction
02
Installation
03
Example
04
Tutorial

Introduction

  • Look and feel of iOS TableView - because it is! (with group/plain tableview type, sections headers, etc)
  • Display long lists of data (like country list) with no performance loss
  • Built-in accessory types (checkmark or disclosure indicator)
  • Pull to refresh!
  • Automatic scroll to initial selected value during component initialization (autoFocus property)
  • Automatic item selection with “checkmark” with old item de-selection (optionally), see demo, useful to select country/state/etc.
  • Render Native Section Index Titles (sectionIndexTitlesEnabled property)
  • Native JSON support for datasource. If you need to display large dataset, generated Javascript will became very large and impact js loading time. To solve this problem the component could read JSON directly from app bundle without JS!
  • Filter JSON datasources using NSPredicate syntax. For example you could select states for given country only (check demo)
  • Create custom UITableView cells with flexible height using React Native syntax (TableView.Cell tag)
  • Use TableView as menu to navigate to other screens (check included demo, using react-navigation https://reactnavigation.org)
  • Native editing mode for table - move/delete option is supported by using attributes canMove, canEdit for items/sections

Installation

npm install react-native-tableview --save
yarn add react-native-tableview

Linking

react-native link react-native-tableview

Example


import React, {Component} from 'react';
import { Text, View, ScrollView,TextInput,StyleSheet } from 'react-native';
import { Cell,Section, TableView } from 'react-native-tableview-simple';

export default class App extends Component{
  render() {
    return(
      <ScrollView contentContainerStyle={styles.conatiner}>
        <TableView >
          <Section header='STANDARD' footer='End of the Table'>
          <Cell cellStyle='Basic' title='Basic' />
          <Cell cellStyle='RightDetail' title="RightDetail" detail="Detail" />
          <Cell cellStyle='Subtitle' title="Developer Mode" detail="OFF" />
          <Cell cellStyle='Basic' title="Press to send Massage" onPress={() => console.log('heyyo from table')}  />
          </Section>
        </TableView>
      </ScrollView>
    )
  }
}
const styles= StyleSheet.create({
  conatiner:{
    backgroundColor: '#EFEFF4',
    paddingTop:20,
    paddingBottom:20
  }
})

Tutorial


Previous Article
Table With Images
Next Article
Disabled Table
Utkarsh Lubal

Utkarsh Lubal

Full Stack Developer

Related Posts

Disabled Table
Disabled Table
June 15, 2022
1 min

Quick Links

Advertise with usAbout UsContact Us

Social Media