### Install React Native Super Grid Source: https://github.com/saleel/react-native-super-grid/blob/master/README.md Installs the react-native-super-grid package using npm. This is the first step to use the grid components in your React Native project. ```bash npm install react-native-super-grid ``` -------------------------------- ### React Native FlatGrid Basic Implementation Source: https://github.com/saleel/react-native-super-grid/blob/master/README.md This JavaScript code demonstrates a basic implementation of the FlatGrid component from 'react-native-super-grid'. It displays a list of items with names and color codes in a grid format. The component requires 'react-native' and 'react-native-super-grid' as dependencies. It takes an array of items as input and renders each item with specified styling, including background color and text. ```javascript import React from 'react'; import { StyleSheet, View, Text } from 'react-native'; import { FlatGrid } from 'react-native-super-grid'; export default function Example() { const [items, setItems] = React.useState([ { name: 'TURQUOISE', code: '#1abc9c' }, { name: 'EMERALD', code: '#2ecc71' }, { name: 'PETER RIVER', code: '#3498db' }, { name: 'AMETHYST', code: '#9b59b6' }, { name: 'WET ASPHALT', code: '#34495e' }, { name: 'GREEN SEA', code: '#16a085' }, { name: 'NEPHRITIS', code: '#27ae60' }, { name: 'BELIZE HOLE', code: '#2980b9' }, { name: 'WISTERIA', code: '#8e44ad' }, { name: 'MIDNIGHT BLUE', code: '#2c3e50' }, { name: 'SUN FLOWER', code: '#f1c40f' }, { name: 'CARROT', code: '#e67e22' }, { name: 'ALIZARIN', code: '#e74c3c' }, { name: 'CLOUDS', code: '#ecf0f1' }, { name: 'CONCRETE', code: '#95a5a6' }, { name: 'ORANGE', code: '#f39c12' }, { name: 'PUMPKIN', code: '#d35400' }, { name: 'POMEGRANATE', code: '#c0392b' }, { name: 'SILVER', code: '#bdc3c7' }, { name: 'ASBESTOS', code: '#7f8c8d' }, ]); return ( ( {item.name} {item.code} )} /> ); } const styles = StyleSheet.create({ gridView: { marginTop: 10, flex: 1, }, itemContainer: { justifyContent: 'flex-end', borderRadius: 5, padding: 10, height: 150, }, itemName: { fontSize: 16, color: '#fff', fontWeight: '600', }, itemCode: { fontWeight: '600', fontSize: 12, color: '#fff', }, }); ``` -------------------------------- ### React Native SectionGrid Implementation Source: https://github.com/saleel/react-native-super-grid/blob/master/README.md This snippet demonstrates the implementation of the SectionGrid component from the 'react-native-super-grid' library. It sets up state for grid items, defines sections with titles and data, and customizes the rendering of individual items and section headers. Dependencies include React and React Native core components. ```javascript import React, { Component } from 'react'; import { StyleSheet, View, Text } from 'react-native'; import { SectionGrid } from 'react-native-super-grid'; export default function Example() { const [items, setItems] = React.useState([ { name: 'TURQUOISE', code: '#1abc9c' }, { name: 'EMERALD', code: '#2ecc71' }, { name: 'PETER RIVER', code: '#3498db' }, { name: 'AMETHYST', code: '#9b59b6' }, { name: 'WET ASPHALT', code: '#34495e' }, { name: 'GREEN SEA', code: '#16a085' }, { name: 'NEPHRITIS', code: '#27ae60' }, { name: 'BELIZE HOLE', code: '#2980b9' }, { name: 'WISTERIA', code: '#8e44ad' }, { name: 'MIDNIGHT BLUE', code: '#2c3e50' }, { name: 'SUN FLOWER', code: '#f1c40f' }, { name: 'CARROT', code: '#e67e22' }, { name: 'ALIZARIN', code: '#e74c3c' }, { name: 'CLOUDS', code: '#ecf0f1' }, { name: 'CONCRETE', code: '#95a5a6' }, { name: 'ORANGE', code: '#f39c12' }, { name: 'PUMPKIN', code: '#d35400' }, { name: 'POMEGRANATE', code: '#c0392b' }, { name: 'SILVER', code: '#bdc3c7' }, { name: 'ASBESTOS', code: '#7f8c8d' }, ]); return ( ( {item.name} {item.code} )} renderSectionHeader={({ section }) => ( {section.title} )} /> ); } const styles = StyleSheet.create({ gridView: { marginTop: 20, flex: 1, }, itemContainer: { justifyContent: 'flex-end', borderRadius: 5, padding: 10, height: 150, }, itemName: { fontSize: 16, color: '#fff', fontWeight: '600', }, itemCode: { fontWeight: '600', fontSize: 12, color: '#fff', }, sectionHeader: { flex: 1, fontSize: 15, fontWeight: '600', alignItems: 'center', backgroundColor: '#636e72', color: 'white', padding: 10, }, }); ``` -------------------------------- ### Usage: FlatGrid Component in React Native Source: https://github.com/saleel/react-native-super-grid/blob/master/README.md Demonstrates how to import and use the FlatGrid component from react-native-super-grid. FlatGrid is similar to React Native's FlatList and renders items in a responsive grid layout. ```javascript import { FlatGrid } from 'react-native-super-grid'; ({item})} /> ``` -------------------------------- ### Usage: SectionGrid Component in React Native Source: https://github.com/saleel/react-native-super-grid/blob/master/README.md Illustrates how to import and use the SectionGrid component. This component is analogous to React Native's SectionList, organizing data into sections within a responsive grid layout. ```javascript import { SectionGrid } from 'react-native-super-grid'; ({item})} renderSectionHeader={({ section }) => ( {section.title} )} /> ``` -------------------------------- ### Usage: SimpleGrid Component in React Native Source: https://github.com/saleel/react-native-super-grid/blob/master/README.md Shows the import and usage of the SimpleGrid component from react-native-super-grid. SimpleGrid is a basic grid component suitable for smaller datasets or when used within a ScrollView, as it does not rely on FlatList. ```javascript import { SimpleGrid } from 'react-native-super-grid'; ({item})} /> ``` -------------------------------- ### Full Width Item in React Native Super Grid Source: https://github.com/saleel/react-native-super-grid/blob/master/README.md Demonstrates how to make a single item occupy the full width of the grid by adding a `_fullWidth: true` property to the item's data object. This is useful for displaying banners or special content within the grid layout. ```javascript { name: 'TURQUOISE', code: '#1abc9c', _fullWidth: true } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.