question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Grid inside List should support flex

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://jsfiddle.net/chunlea/zxsb1kpd/

Steps to reproduce

Created a List with Card, enable grid, and the layout is mass.

screenshot 2019-01-17 at 9 56 57 pm

What is expected?

Like Row Component, with flex, the layout should look like

screenshot 2019-01-17 at 10 00 20 pm

What is actually happening?

I looked at the source code and found that https://github.com/ant-design/ant-design/blob/master/components/list/index.tsx#L232 we only pass grid.gutter to Row and use Context to pass other options to List.Item col

Maybe we should support all RowProps fields here https://github.com/ant-design/ant-design/blob/master/components/grid/row.tsx#L29-L35 in grid of List Component?

Environment Info
antd 3.12.3
React 16.7.0
System macOS
Browser Chrome 71

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

2reactions
asadercommented, Jan 7, 2020

Here’s simple workaround

export const FlexList = ({ dataSource, renderItem, gutter}) => (<Row gutter={gutter} type='flex'>{ dataSource.map(entity => renderItem(entity)) }</Row>);

0reactions
harunurhancommented, Feb 27, 2020

As a workaround, you can wrap all items (children), with a <div className="ant-row-flex"

      <List
        grid={...}
      >
        <div className="ant-row-flex">
          {items.map(...)}
        </div>
      </List>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Relationship of grid layout to other layout methods - CSS
In this guide, I will explain how a grid fits together with other ... The basic difference between CSS Grid Layout and CSS...
Read more >
How to combine Flexbox and CSS grids for efficient layouts
Starting from the outside and working in, adding display: flex; to the container is the first step in any Flexbox layout. The flex-direction...
Read more >
Grid for layout, Flexbox for components - Ahmad Shadeed
Flexbox is laying out an inline list of elements, while CSS grid made them a grid of columns and rows. Flexbox is aligning...
Read more >
CSS Grid inside Flexbox not working as expected only on ...
The flexbox ( .container ) fills the entire viewport. · The height of the header is variable. · The four cells in the...
Read more >
A Complete Guide to CSS Grid
This could happen if all of your grid items are sized with non-flexible units like px . In this case you can set...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found