fix
This commit is contained in:
@@ -219,6 +219,20 @@ const DocumentInfoPanel = ({
|
|||||||
return visibleTabs[0].id;
|
return visibleTabs[0].id;
|
||||||
}, [visibleTabs, defaultTabId]);
|
}, [visibleTabs, defaultTabId]);
|
||||||
|
|
||||||
|
const renderTabContent = (tab, context = {}) => {
|
||||||
|
if (!tab) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (typeof tab.render === 'function') {
|
||||||
|
return tab.render(context);
|
||||||
|
}
|
||||||
|
if (tab.component) {
|
||||||
|
const TabComponent = tab.component;
|
||||||
|
return <TabComponent {...context} />;
|
||||||
|
}
|
||||||
|
return React.isValidElement(tab.render) ? tab.render : null;
|
||||||
|
};
|
||||||
|
|
||||||
const isControlled = controlledActiveTab !== undefined && controlledActiveTab !== null;
|
const isControlled = controlledActiveTab !== undefined && controlledActiveTab !== null;
|
||||||
const [uncontrolledTab, setUncontrolledTab] = useState(
|
const [uncontrolledTab, setUncontrolledTab] = useState(
|
||||||
isControlled ? controlledActiveTab : fallbackTabId,
|
isControlled ? controlledActiveTab : fallbackTabId,
|
||||||
|
|||||||
Reference in New Issue
Block a user