diff --git a/src/blocks/Tabs/Tabs.tsx b/src/blocks/Tabs/Tabs.tsx index 3eb29937d..d40b80c34 100644 --- a/src/blocks/Tabs/Tabs.tsx +++ b/src/blocks/Tabs/Tabs.tsx @@ -1,4 +1,4 @@ -import React, {Fragment, useCallback, useRef, useState} from 'react'; +import React, {Fragment, useCallback, useEffect, useRef, useState} from 'react'; import {useUniqId} from '@gravity-ui/uikit'; @@ -56,16 +56,19 @@ export const TabsBlock = ({ const onSelectTab = useCallback( (id: string | null, e: React.MouseEvent) => { setActiveTab(id); - handleImageHeight(); e.currentTarget.scrollIntoView({ inline: 'center', behavior: 'smooth', block: 'nearest', }); }, - [handleImageHeight], + [], ); + useEffect(() => { + handleImageHeight(); + }, [activeTab, handleImageHeight]); + if (activeTabData) { const themedImage = getThemedValue(activeTabData?.image, theme); @@ -102,8 +105,8 @@ export const TabsBlock = ({ }} className={b('col', {centered: centered})} > -
- {activeTabData?.media && ( + {activeTabData?.media && ( +
- )} -
+
+ )} {imageProps && (