// @flow import * as React from 'react'; import {View} from 'react-native'; import {withTheme} from 'react-native-paper'; import type {ViewStyle} from 'react-native/Libraries/StyleSheet/StyleSheet'; import type {CellType} from './CellComponent'; import CellComponent from './CellComponent'; export type GridType = Array>; type PropsType = { grid: Array>, height: number, width: number, style: ViewStyle, }; class GridComponent extends React.Component { getRow(rowNumber: number): React.Node { const {grid} = this.props; return ( {grid[rowNumber].map(this.getCellRender)} ); } getCellRender = (item: CellType): React.Node => { return ; }; getGrid(): React.Node { const {height} = this.props; const rows = []; for (let i = 0; i < height; i += 1) { rows.push(this.getRow(i)); } return rows; } render(): React.Node { const {style, width, height} = this.props; return ( {this.getGrid()} ); } } export default withTheme(GridComponent);