@@ -37,7 +37,7 @@ import * as React from 'react';
3737import Body from './Body' ;
3838import ColGroup from './ColGroup' ;
3939import { EXPAND_COLUMN , INTERNAL_HOOKS } from './constant' ;
40- import TableContext , { makeImmutable } from './context/TableContext' ;
40+ import TableContext , { makeImmutable , type ScrollInfoType } from './context/TableContext' ;
4141import type { FixedHeaderProps } from './FixedHolder' ;
4242import FixedHolder from './FixedHolder' ;
4343import Footer , { FooterComponents } from './Footer' ;
@@ -75,6 +75,7 @@ import Column from './sugar/Column';
7575import ColumnGroup from './sugar/ColumnGroup' ;
7676import { getColumnsKey , validateValue , validNumberValue } from './utils/valueUtil' ;
7777import { getDOM } from '@rc-component/util/lib/Dom/findDOMNode' ;
78+ import isEqual from '@rc-component/util/lib/isEqual' ;
7879
7980export const DEFAULT_PREFIX = 'rc-table' ;
8081
@@ -435,6 +436,8 @@ function Table<RecordType extends DefaultRecordType>(
435436 }
436437 }
437438
439+ const [ scrollInfo , setScrollInfo ] = React . useState < ScrollInfoType > ( [ 0 , 0 ] ) ;
440+
438441 const onInternalScroll = useEvent (
439442 ( { currentTarget, scrollLeft } : { currentTarget : HTMLElement ; scrollLeft ?: number } ) => {
440443 const isRTL = direction === 'rtl' ;
@@ -459,6 +462,12 @@ function Table<RecordType extends DefaultRecordType>(
459462 ? mergedScrollX
460463 : measureTarget . scrollWidth ;
461464 const clientWidth = measureTarget . clientWidth ;
465+
466+ setScrollInfo ( ori => {
467+ const nextScrollInfo : ScrollInfoType = [ mergedScrollLeft , scrollWidth - clientWidth ] ;
468+ return isEqual ( ori , nextScrollInfo ) ? ori : nextScrollInfo ;
469+ } ) ;
470+
462471 // There is no space to scroll
463472 if ( scrollWidth === clientWidth ) {
464473 setPingedLeft ( false ) ;
@@ -798,6 +807,7 @@ function Table<RecordType extends DefaultRecordType>(
798807 ( ) => ( {
799808 // Scroll
800809 scrollX : mergedScrollX ,
810+ scrollInfo,
801811
802812 // Table
803813 prefixCls,
@@ -847,6 +857,7 @@ function Table<RecordType extends DefaultRecordType>(
847857 [
848858 // Scroll
849859 mergedScrollX ,
860+ scrollInfo ,
850861
851862 // Table
852863 prefixCls ,
0 commit comments