0.1.0 • Published 11 months ago

react-native-spreadsheet-view v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

react-native-spreadsheet-view

A component for supporting spreadsheet liked grid in React Native.

Features to be supported:

  • Frozen header row, left columns
  • Bi-directional scroll
  • Re-renderable by each cell
  • Merge allowed cells
  • Row selection

How-to use

import { SpreadsheetView } from "react-native-spreadsheet-view";
import { View, Text } from "react-native";


export default function Example () {
    return <View style={{paddingTop:100, paddingBottom:50}}>
        <SpreadsheetView
            numRows={300}
            numColumns={200}
            sizeForRow={40}
            sizeForColumn={120}
            renderItem={({indexPath}) => {
                return <Text>{`${indexPath.row},${indexPath.column}`}}</Text>
            }}
        />
    </View>
}

Example - frozen table

import { SpreadsheetView } from "react-native-spreadsheet-view";

const fields = [{key: 'id', label: '#'}, {key: 'name', label: 'Name'}, {key: 'city_name', label: 'City Name'}]
const data = [{id: 1, name: 'Paul', city_name: 'Tokyo'}]

export default function Example () {
    return <SpreadsheetView
        frozenRows={1}
        frozenColumns={1}
        sizeForRow={40}
        sizeForColumn={120}
        numRows={data.length + 1}
        numColumns={fields.length + 1}
        renderItem={({indexPath}) => {
            const field = fields[indexPath.column]
            if (indexPath.row === 0 ) {
                return <Text>{field.label}</Text>
            }
            return  <Text>{data[field.key]}</Text>
        }}
    />
}

Example - data grid

import { DataGrid } from "react-native-spreadsheet-view";

const fields = [{key: 'id', label: '#'}, {key: 'name', label: 'Name'}, {key: 'city_name', label: 'City Name'}]
const data = [{id: 1, name: 'Paul', city_name: 'Tokyo'}]

export default function Example () {
    return <DataGrid
        columns={fields}
        data={data}
    />
}
0.1.0

11 months ago

0.0.14

11 months ago

0.0.13

11 months ago

0.0.12

11 months ago

0.0.11

11 months ago

0.0.10

11 months ago

0.0.9

11 months ago

0.0.8

11 months ago

0.0.7

11 months ago

0.0.6

11 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago