Add hasOwnProperty checks for child fields in Tabs

Summary:
Add hasOwnProperty checks for child props in Tabs. This prevents warning output when a prop doesn't exist.

{F748481722}

Reviewed By: mweststrate

Differential Revision: D37520888

fbshipit-source-id: 3b0c9fb1e94e76ecb4eb52e97d2f3aa010cb60ce
This commit is contained in:
James Wysynski
2022-07-04 09:24:57 -07:00
committed by Facebook GitHub Bot
parent d162bcc2a4
commit 0016b72b37

View File

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