From 4f36a7244e4071c7ef53221ee8b647fd1c1a5ddd Mon Sep 17 00:00:00 2001 From: hackerman <3372410+aeneasr@users.noreply.github.com> Date: Thu, 26 Nov 2020 11:45:15 +0100 Subject: [PATCH] fix(v2): support rendering of singular tabs Closes #3822 --- packages/docusaurus-theme-classic/src/theme/Tabs/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/docusaurus-theme-classic/src/theme/Tabs/index.tsx b/packages/docusaurus-theme-classic/src/theme/Tabs/index.tsx index 7616a73c5074..46a3afeaf3cc 100644 --- a/packages/docusaurus-theme-classic/src/theme/Tabs/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Tabs/index.tsx @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import React, {useState, cloneElement} from 'react'; +import React, {useState, cloneElement, Children} from 'react'; import useUserPreferencesContext from '@theme/hooks/useUserPreferencesContext'; import type {Props} from '@theme/Tabs'; @@ -22,7 +22,6 @@ function Tabs(props: Props): JSX.Element { const { lazy, block, - children, defaultValue, values, groupId, @@ -30,6 +29,7 @@ function Tabs(props: Props): JSX.Element { } = props; const {tabGroupChoices, setTabGroupChoices} = useUserPreferencesContext(); const [selectedValue, setSelectedValue] = useState(defaultValue); + const children = Children.toArray(props.children) if (groupId != null) { const relevantTabGroupChoice = tabGroupChoices[groupId];