diff --git a/package.json b/package.json index 7941b86..7e9726f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@protonapp/material-components", - "version": "0.9.42", + "version": "0.9.43", "description": "Material UI Components for Proton", "main": "index.js", "scripts": { diff --git a/src/CardList/index.js b/src/CardList/index.js index 5546008..b0eeac8 100644 --- a/src/CardList/index.js +++ b/src/CardList/index.js @@ -65,6 +65,26 @@ export default class ImageList extends Component { return columns } + getRows(items) { + const columnCount = this.getColumnCount() + const count = Math.ceil(items.length / columnCount) + const rows = [] + + for (let i = 0; i < items.length; i += 1) { + const row = Math.floor(i / count) + + if (!rows[row]) { + rows[row] = [] + } + + if (items[i]) { + rows[row].push(items[i]) + } + } + + return rows + } + renderCell = (itm, layout, editor, _fonts, width = null) => ( - {items.map((itm, i) => - this.renderCell(itm, layout, editor, _fonts, width) - )} + {rows.map((row, i) => ( + + {row.map((itm, j) => ( + + {this.renderCell(itm, layout, editor, _fonts)} + + ))} + + ))} ) } @@ -409,7 +435,6 @@ class Cell extends Component { render() { let { onPress, - media, button1, button2, icon1, @@ -420,8 +445,6 @@ class Cell extends Component { editor, } = this.props - let mediaPosition = media && media.position - let cell = [styles.cell, { width }] let { @@ -695,6 +718,12 @@ const styles = StyleSheet.create({ flexDirection: 'column', flex: 1, }, + row: { + flexDirection: 'row', + flex: 1, + flexBasis: '100%', + alignItems: 'flex-start', + }, cell: { marginLeft: 4, marginRight: 4,