0.1.0 • Published 2 years ago

react-native-spreadsheet-view v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years 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

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago