diff --git a/src/TabPanelList/TabPane.tsx b/src/TabPanelList/TabPane.tsx index 6efa9b72..f8cfd64c 100644 --- a/src/TabPanelList/TabPane.tsx +++ b/src/TabPanelList/TabPane.tsx @@ -44,10 +44,11 @@ export default function TabPane({ const mergedStyle: React.CSSProperties = {}; if (!active) { - if (animated) { - mergedStyle.visibility = 'hidden'; - } else { - mergedStyle.display = 'none'; + mergedStyle.visibility = 'hidden'; + + if (!animated) { + mergedStyle.height = 0; + mergedStyle.overflowY = 'hidden'; } } diff --git a/src/TabPanelList/index.tsx b/src/TabPanelList/index.tsx index 6480c997..55502a62 100644 --- a/src/TabPanelList/index.tsx +++ b/src/TabPanelList/index.tsx @@ -31,9 +31,7 @@ export default function TabPanelList({ className={classNames(`${prefixCls}-content`, `${prefixCls}-content-${tabPosition}`, { [`${prefixCls}-content-animated`]: tabPaneAnimated, })} - style={ - tabPaneAnimated ? { [rtl ? 'marginRight' : 'marginLeft']: `-${activeIndex}00%` } : null - } + style={{ [rtl ? 'marginRight' : 'marginLeft']: `-${activeIndex}00%` }} > {tabs.map(tab => { return React.cloneElement(tab.node, { diff --git a/tests/__snapshots__/index.test.tsx.snap b/tests/__snapshots__/index.test.tsx.snap index 43335b17..4f5a1a02 100644 --- a/tests/__snapshots__/index.test.tsx.snap +++ b/tests/__snapshots__/index.test.tsx.snap @@ -76,6 +76,7 @@ exports[`Tabs.Basic Normal 1`] = ` >