Support tabKey and key for tab keys

Summary:
Support tabKey and key properties for tab keys in Tabs/Tab.

tabKey > tab > key > tab_{idx}

Reviewed By: aigoncharov

Differential Revision: D37412130

fbshipit-source-id: 56ade27a02a7ba2926534a81d92dd1e9229576f4
This commit is contained in:
James Wysynski
2022-06-24 07:02:50 -07:00
committed by Facebook GitHub Bot
parent d1561075bb
commit 3a8226b890

View File

@@ -30,7 +30,10 @@ export function Tabs({
return; return;
} }
const tabKey = const tabKey =
(typeof child.props.tab === 'string' && child.props.tab) || `tab_${idx}`; (typeof child.props.tabKey === 'string' && child.props.tabKey) ||
(typeof child.props.tab === 'string' && child.props.tab) ||
(typeof child.props.key === 'string' && child.props.key) ||
`tab_${idx}`;
keys.push(tabKey); keys.push(tabKey);
return { return {
...child, ...child,