Skip to content

Commit 87b7e5b

Browse files
mbohalbedrich-schindler
authored andcommitted
Ease PropType validation of the children prop to allow passing in nonrenderable false and null values (#332)
1 parent ef0e119 commit 87b7e5b

File tree

5 files changed

+5
-20
lines changed

5 files changed

+5
-20
lines changed

src/lib/components/CTA/CTA.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ CTA.propTypes = {
5252
* * `CTACenter`
5353
* * `CTAEnd`
5454
*/
55-
children: PropTypes.oneOfType([
56-
PropTypes.element,
57-
PropTypes.arrayOf(PropTypes.element),
58-
]).isRequired,
55+
children: PropTypes.node.isRequired,
5956
};
6057

6158
export const CTAWithContext = withProviderContext(CTA, 'CTA');

src/lib/components/Card/Card.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ Card.propTypes = {
4141
* * `CardFooter`
4242
* * `ScrollView`
4343
*/
44-
children: PropTypes.oneOfType([
45-
PropTypes.element,
46-
PropTypes.arrayOf(PropTypes.element),
47-
]).isRequired,
44+
children: PropTypes.node.isRequired,
4845
/**
4946
* [Color variant](/foundation/colors#component-colors) to clarify importance and meaning of the card.
5047
*/

src/lib/components/FormLayout/FormLayout.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,7 @@ FormLayout.propTypes = {
8989
* * `TextField`
9090
* * `Toggle`
9191
*/
92-
children: PropTypes.oneOfType([
93-
PropTypes.element,
94-
PropTypes.arrayOf(PropTypes.element),
95-
]),
92+
children: PropTypes.node,
9693
/**
9794
* Layout that is forced on children form fields.
9895
*/

src/lib/components/Media/Media.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ Media.propTypes = {
2121
* * `MediaBody`
2222
* * `MediaObject`
2323
*/
24-
children: PropTypes.oneOfType([
25-
PropTypes.element,
26-
PropTypes.arrayOf(PropTypes.element),
27-
]).isRequired,
24+
children: PropTypes.node.isRequired,
2825
};
2926

3027
export const MediaWithContext = withProviderContext(Media, 'Media');

src/lib/components/Tabs/Tabs.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ Tabs.propTypes = {
2626
/**
2727
* Nested `TabsItem` elements.
2828
*/
29-
children: PropTypes.oneOfType([
30-
PropTypes.element,
31-
PropTypes.arrayOf(PropTypes.element),
32-
]),
29+
children: PropTypes.node,
3330
/**
3431
* ID of the root HTML element. It also serves as base for nested element:
3532
* * `<ID>__list`

0 commit comments

Comments
 (0)