JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 735
  • Score
    100M100P100Q120498F
  • License MIT

A flexible grid component inspired by CSS Grid for react native

Package Exports

  • react-native-flexible-grid
  • react-native-flexible-grid/lib/commonjs/index.js
  • react-native-flexible-grid/lib/module/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-native-flexible-grid) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-native-flexible-grid

A flexible grid component inspired by CSS Grid for React Native

Installation

npm install react-native-flexible-grid

Usage

import { CellGrid } from 'react-native-flexible-grid';

 export default function App() {

  const data = [
    {
      widthRatio: 1,
      heightRatio: 1,
      text: 'Cell 1',
    },
    {
      widthRatio: 1,
      heightRatio: 1,
      text: 'Cell 2',
    },
  ];

  const renderItem = (item: any, _: number) => {
    return (
      <TouchableOpacity
        style={styles.boxContainer}
        onPress={() => {
          console.log(item.text, 'pressed');
        }}
      >
        <View style={styles.box}>
          <Text style={styles.text}>{item.text}</Text>
        </View>
      </TouchableOpacity>
    );
  };

  return (
    <View style={styles.container}>
      <CellGrid
        maxWidthRatio={4}
        cellSize={80}
        data={data}
        viewportBuffer={200}
        renderItem={renderItem}
        enableVirtualization={true}
      />
    </View>
  );
}

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT