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:
committed by
Facebook GitHub Bot
parent
d162bcc2a4
commit
0016b72b37
@@ -30,9 +30,15 @@ export function Tabs({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const tabKey =
|
const tabKey =
|
||||||
(typeof child.props.tabKey === 'string' && child.props.tabKey) ||
|
(child.hasOwnProperty('tabKey') &&
|
||||||
(typeof child.props.tab === 'string' && child.props.tab) ||
|
typeof child.props.tabKey === 'string' &&
|
||||||
(typeof child.props.key === 'string' && child.props.key) ||
|
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}`;
|
`tab_${idx}`;
|
||||||
keys.push(tabKey);
|
keys.push(tabKey);
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user