ant-design icon indicating copy to clipboard operation
ant-design copied to clipboard

Responsive Col don't support 'flex' prop in ColSize

Open RplusSoundOn opened this issue 3 years ago • 17 comments

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://codepen.io/rplussoundon/pen/ExgJZVb?editors=0010

Steps to reproduce

To resize between md and lg, the flex prop doesn't apply.

What is expected?

flex value should inject to the element inlin style when window size is larger than md.

What is actually happening?

flex value does't apply.

Environment Info
antd 4.7.0
React 16.13.1
System Mac
Browser Chrome 87.0.4280.141

RplusSoundOn avatar Jan 21 '21 07:01 RplusSoundOn

ColSize should suppot flex prop image

RplusSoundOn avatar Jan 21 '21 07:01 RplusSoundOn

Bumping as I'm having the same issue. Setting the flex prop via a breakpoint param is not affecting the columns as expected.

<Col xs={12} md={{ flex: 'auto' }}>
...

I have confirmed other properties are behaving as expected:

<Col xs={12} md={{ push: 12 }}>
...

bendrick92 avatar Mar 19 '21 20:03 bendrick92

Same issue. Not working as expected.

<Col xs={{ flex: "0 0 100%" }} sm={{ flex: "0 0 auto" }}></Col>

gradddev avatar Mar 26 '21 10:03 gradddev

Bumping - any update on a fix?

bendrick92 avatar Jul 16 '21 20:07 bendrick92

Another bump...

bendrick92 avatar Nov 12 '21 22:11 bendrick92

@afc163 有实现计划么?或许可以用 responsiveObserve 做动态设置?

curly210102 avatar Jan 10 '22 04:01 curly210102

@curly210102 有,可行。

afc163 avatar Jan 10 '22 04:01 afc163

@afc163 那我上手改咯

curly210102 avatar Jan 10 '22 04:01 curly210102

@afc163 Hello! When will it be released? => 33656

Tideus avatar Jun 09 '22 05:06 Tideus

I would love to see this released too. The docs make it seem like the expected behavior

xs|sm|md|lg|xl|xxl

Could be a span value or an object containing above props (e.g. "flex")

evenmed avatar Jul 20 '22 21:07 evenmed

Having the same issue, has it been solved? Or is there any alternative way to implement responsive flex with the current version?

shieldAgentJZ avatar Aug 05 '22 19:08 shieldAgentJZ

I am also facing the same issue. I am not able to apply flex for responsive.

naimeshbarot avatar Aug 09 '22 14:08 naimeshbarot

Bump

Daneng66 avatar Aug 24 '22 15:08 Daneng66

Bump LOL

beltjun26 avatar Oct 24 '22 18:10 beltjun26

Em... Bump ?

DjVreditel avatar Feb 15 '23 12:02 DjVreditel

today i discovered this issue, some news about a fix on this?

CSDev0 avatar Feb 23 '23 02:02 CSDev0

Bump

protetore avatar Mar 02 '23 12:03 protetore

same

songyot11 avatar Mar 09 '23 03:03 songyot11

Same issue

aalvarezwindey avatar Mar 23 '23 11:03 aalvarezwindey

Is maybe missing here https://github.com/ant-design/ant-design/blob/master/components/grid/col.tsx#L82 something like that?

    sizeClassObj = {
      ...sizeClassObj,
      [`${prefixCls}-${size}-${sizeProps.span}`]: sizeProps.span !== undefined,
      [`${prefixCls}-${size}-order-${sizeProps.order}`]: sizeProps.order || sizeProps.order === 0,
      [`${prefixCls}-${size}-offset-${sizeProps.offset}`]:
        sizeProps.offset || sizeProps.offset === 0,
      [`${prefixCls}-${size}-push-${sizeProps.push}`]: sizeProps.push || sizeProps.push === 0,
      [`${prefixCls}-${size}-pull-${sizeProps.pull}`]: sizeProps.pull || sizeProps.pull === 0,
      [`${prefixCls}-rtl`]: direction === 'rtl',

      // next line is missing
      [`${prefixCls}-${size}-flex-${sizeProps.flex}`]: sizeProps.flex || sizeProps.flex === '', // 
    };

aalvarezwindey avatar Mar 23 '23 12:03 aalvarezwindey

Is there a fix that was merged about this problem but in later versions this error still appears? Any solution or example of how this works? xs={{ flex: 'auto' }}

AlexisSniffer avatar Apr 19 '23 17:04 AlexisSniffer

fix doesn't work

extremecode0xFF avatar Apr 28 '23 11:04 extremecode0xFF

BUMP

DjVreditel avatar Aug 21 '23 09:08 DjVreditel

BUMP!!!

chungnq253 avatar Aug 24 '23 11:08 chungnq253

@AlexisSniffer @afc163 the pull request https://github.com/ant-design/ant-design/pull/41962 added a flex prop to ColSize. However, there's no CSS for it in genLoopGridColumnsStyle, so the prop doesn't do anything when set.

Please can this be reopened?

This is a workaround to enable the flex keywords:

.ant-col-xs-flex-initial { flex: initial; }
.ant-col-xs-flex-auto { flex: auto; }
.ant-col-xs-flex-none { flex: none; }
@media (min-width: 576px) {
  .ant-col-sm-flex-initial { flex: initial; }
  .ant-col-sm-flex-auto { flex: auto; }
  .ant-col-sm-flex-none { flex: none; }
}
@media (min-width: 768px) {
  .ant-col-md-flex-initial { flex: initial; }
  .ant-col-md-flex-auto { flex: auto; }
  .ant-col-md-flex-none { flex: none; }
}
@media (min-width: 992px) {
  .ant-col-lg-flex-initial { flex: initial; }
  .ant-col-lg-flex-auto { flex: auto; }
  .ant-col-lg-flex-none { flex: none; }
}
@media (min-width: 1200px) {
  .ant-col-xl-flex-initial { flex: initial; }
  .ant-col-xl-flex-auto { flex: auto; }
  .ant-col-xl-flex-none { flex: none; }
}
@media (min-width: 1600px) {
  .ant-col-xxl-flex-initial { flex: initial; }
  .ant-col-xxl-flex-auto { flex: auto; }
  .ant-col-xxl-flex-none { flex: none; }
}

Tantalon avatar Sep 10 '23 23:09 Tantalon

It works for me in the following way

<Col flex={'auto'} xs={0} lg={24}>

where I add the property flex={'auto'} to auto adjust with the other elements xs={0} I don't want it to show up to lg size lg={24} so that it takes the total size that the flex would take: 'auto'

AlexisSniffer avatar Sep 12 '23 03:09 AlexisSniffer

这个问题在4.x的版本上也存在, 能否修复一下

yangfanzn avatar Dec 08 '23 10:12 yangfanzn