File tree Expand file tree Collapse file tree 4 files changed +16
-9
lines changed Expand file tree Collapse file tree 4 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -61,8 +61,6 @@ function ExpandedRow(props: ExpandedRowProps) {
6161 className = { className }
6262 style = { {
6363 display : expanded ? null : 'none' ,
64- // fix https://github.com/ant-design/ant-design/issues/49279
65- visibility : isEmpty && horizonScroll && ! componentWidth ? 'hidden' : null ,
6664 } }
6765 >
6866 < Cell component = { cellComponent } prefixCls = { prefixCls } colSpan = { colSpan } >
Original file line number Diff line number Diff line change @@ -495,9 +495,9 @@ function Table<RecordType extends DefaultRecordType>(
495495 }
496496 } ;
497497
498- const onFullTableResize = ( { width } ) => {
498+ const onFullTableResize = ( offsetWidth ?: number ) => {
499499 stickyRef . current ?. checkScrollBarVisible ( ) ;
500- let mergedWidth = fullTableRef . current ? fullTableRef . current . offsetWidth : width ;
500+ let mergedWidth = offsetWidth ?? fullTableRef . current ? .offsetWidth ?? 0 ;
501501 if ( useInternalHooks && getContainerWidth && fullTableRef . current ) {
502502 mergedWidth = getContainerWidth ( fullTableRef . current , mergedWidth ) || mergedWidth ;
503503 }
@@ -508,6 +508,13 @@ function Table<RecordType extends DefaultRecordType>(
508508 }
509509 } ;
510510
511+ // fix https://github.com/ant-design/ant-design/issues/49279
512+ useLayoutEffect ( ( ) => {
513+ if ( horizonScroll ) {
514+ onFullTableResize ( ) ;
515+ }
516+ } , [ horizonScroll ] ) ;
517+
511518 // Sync scroll bar when init or `horizonScroll`, `data` and `columns.length` changed
512519 const mounted = React . useRef ( false ) ;
513520 React . useEffect ( ( ) => {
@@ -799,7 +806,11 @@ function Table<RecordType extends DefaultRecordType>(
799806 ) ;
800807
801808 if ( horizonScroll ) {
802- fullTable = < ResizeObserver onResize = { onFullTableResize } > { fullTable } </ ResizeObserver > ;
809+ fullTable = (
810+ < ResizeObserver onResize = { ( { offsetWidth } ) => onFullTableResize ( offsetWidth ) } >
811+ { fullTable }
812+ </ ResizeObserver >
813+ ) ;
803814 }
804815
805816 const fixedInfoList = useFixedInfo ( flattenColumns , stickyOffsets ) ;
Original file line number Diff line number Diff line change @@ -569,7 +569,7 @@ exports[`Table.Expand > renders fixed column correctly > work 1`] = `
569569 >
570570 <div
571571 class = " rc-table-expanded-row-fixed"
572- style = " width: 0px ; position: sticky; left: 0px; overflow: hidden;"
572+ style = " width: 1128px ; position: sticky; left: 0px; overflow: hidden;"
573573 >
574574 <p >
575575 extra data
@@ -616,7 +616,7 @@ exports[`Table.Expand > renders fixed column correctly > work 1`] = `
616616 >
617617 <div
618618 class = " rc-table-expanded-row-fixed"
619- style = " width: 0px ; position: sticky; left: 0px; overflow: hidden;"
619+ style = " width: 1128px ; position: sticky; left: 0px; overflow: hidden;"
620620 >
621621 <p >
622622 extra data
Original file line number Diff line number Diff line change @@ -1819,7 +1819,6 @@ exports[`Table.FixedColumn > renders correctly > scrollX - without data 1`] = `
18191819 </tr >
18201820 <tr
18211821 class = " rc-table-placeholder"
1822- style = " "
18231822 >
18241823 <td
18251824 class = " rc-table-cell"
@@ -2976,7 +2975,6 @@ exports[`Table.FixedColumn > renders correctly > scrollXY - without data 1`] = `
29762975 </tr >
29772976 <tr
29782977 class = " rc-table-placeholder"
2979- style = " "
29802978 >
29812979 <td
29822980 class = " rc-table-cell"
You can’t perform that action at this time.
0 commit comments