// @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 {GridType} from './GridComponent'; import GridComponent from './GridComponent'; type PropsType = { items: Array, style: ViewStyle, }; class Preview extends React.PureComponent { getGrids(): React.Node { const {items} = this.props; const grids = []; items.forEach((item: GridType, index: number) => { grids.push(Preview.getGridRender(item, index)); }); return grids; } static getGridRender(item: GridType, index: number): React.Node { return ( ); } render(): React.Node { const {style, items} = this.props; if (items.length > 0) { return {this.getGrids()}; } return null; } } export default withTheme(Preview);