Skip to content

Commit 58fa26b

Browse files
authored
add missing types and cast ref to LegacyRef (#818)
1 parent 9732053 commit 58fa26b

File tree

1 file changed

+10
-5
lines changed
  • packages/docusaurus-theme-openapi-docs/src/theme/SchemaTabs

1 file changed

+10
-5
lines changed

packages/docusaurus-theme-openapi-docs/src/theme/SchemaTabs/index.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import React, {
1111
useEffect,
1212
useState,
1313
ReactElement,
14+
LegacyRef,
1415
} from "react";
1516

1617
import {
@@ -99,14 +100,18 @@ function TabList({
99100
};
100101
}, []);
101102

102-
const handleRightClick = (e) => {
103+
const handleRightClick = (e: any) => {
103104
e.preventDefault();
104-
tabItemListContainerRef.current.scrollLeft += 90;
105+
if (tabItemListContainerRef.current) {
106+
tabItemListContainerRef.current.scrollLeft += 90;
107+
}
105108
};
106109

107-
const handleLeftClick = (e) => {
110+
const handleLeftClick = (e: any) => {
108111
e.preventDefault();
109-
tabItemListContainerRef.current.scrollLeft -= 90;
112+
if (tabItemListContainerRef.current) {
113+
tabItemListContainerRef.current.scrollLeft -= 90;
114+
}
110115
};
111116

112117
return (
@@ -118,7 +123,7 @@ function TabList({
118123
/>
119124
)}
120125
<ul
121-
ref={tabItemListContainerRef}
126+
ref={tabItemListContainerRef as LegacyRef<HTMLUListElement>}
122127
role="tablist"
123128
aria-orientation="horizontal"
124129
className={clsx(

0 commit comments

Comments
 (0)