Commit b03c95c2 authored by isstuev's avatar isstuev

tabs re-render fix

parent 596ad55c
...@@ -11,6 +11,8 @@ import React, { useEffect, useRef, useState } from 'react'; ...@@ -11,6 +11,8 @@ import React, { useEffect, useRef, useState } from 'react';
import type { TabItem } from './types'; import type { TabItem } from './types';
import isBrowser from 'lib/isBrowser';
import AdaptiveTabsList from './AdaptiveTabsList'; import AdaptiveTabsList from './AdaptiveTabsList';
import { menuButton } from './utils'; import { menuButton } from './utils';
...@@ -39,7 +41,7 @@ const TabsWithScroll = ({ ...@@ -39,7 +41,7 @@ const TabsWithScroll = ({
...themeProps ...themeProps
}: Props) => { }: Props) => {
const [ activeTabIndex, setActiveTabIndex ] = useState<number>(defaultTabIndex || 0); const [ activeTabIndex, setActiveTabIndex ] = useState<number>(defaultTabIndex || 0);
const [ screenWidth, setScreenWidth ] = React.useState(0); const [ screenWidth, setScreenWidth ] = React.useState(isBrowser() ? window.innerWidth : 0);
const tabsRef = useRef<HTMLDivElement>(null); const tabsRef = useRef<HTMLDivElement>(null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment