Shared:Components:Tabs: remove as from type declaration

This commit is contained in:
Darya Umrikhina 2024-06-13 15:16:05 +07:00
parent f9dd563cd1
commit baec28ed6e
2 changed files with 6 additions and 4 deletions

View File

@ -24,7 +24,7 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
import { useState, useRef, MutableRefObject, useEffect } from "react";
import React, { useState, useRef, useEffect } from "react";
import { useTheme } from "styled-components";
import { useViewTab } from "./hooks/useViewTab";
@ -50,7 +50,7 @@ const Tabs = (props: TabsProps) => {
}
const globalTheme = useTheme();
const tabsRef = useRef() as MutableRefObject<HTMLDivElement>;
const tabsRef = useRef<HTMLDivElement>(null);
const [currentItem, setCurrentItem] = useState<TTabItem>(
items[selectedItemIndex],
@ -64,6 +64,8 @@ const Tabs = (props: TabsProps) => {
}, [selectedItemIndex, items]);
const scrollToTab = (index: number): void => {
if (!tabsRef.current) return;
const tabElement = tabsRef.current.children[index] as HTMLElement;
const containerWidth = tabsRef.current.offsetWidth;
const tabWidth = tabElement.offsetWidth;

View File

@ -18,7 +18,7 @@
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
// trademark law for use of our trademarks.s
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
@ -27,7 +27,7 @@
import { useEffect, useState, useRef, RefObject } from "react";
export const useViewTab = (
containerRef: RefObject<HTMLElement>,
containerRef: RefObject<HTMLDivElement>,
index: number,
) => {
const [isViewTab, setIsViewTab] = useState<boolean>(true);