Skip to content

Commit

Permalink
fix(ListBoxMenu): use arrayOf(Component) instead of childrenOfType (#…
Browse files Browse the repository at this point in the history
…6595)

* fix(ListBoxMenu): use arrayOf(Component) instead of childrenOfType

* fix(ListBoxMenu): allow single item with shape type
  • Loading branch information
atikenny authored Aug 3, 2020
1 parent 770ddfb commit e2dd10f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/react/src/components/ListBox/ListBoxMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import React from 'react';
import { settings } from 'carbon-components';
import PropTypes from 'prop-types';
import ListBoxMenuItem from './ListBoxMenuItem';
import childrenOfType from '../../prop-types/childrenOfType';

const { prefix } = settings;

Expand Down Expand Up @@ -39,7 +38,17 @@ ListBoxMenu.propTypes = {
/**
* Provide the contents of your ListBoxMenu
*/
children: childrenOfType(ListBoxMenuItem),
children: PropTypes.oneOfType([
PropTypes.arrayOf(ListBoxMenuItem),
/**
* allow single item using the workaround for functional components
* https://github.com/facebook/react/issues/2979#issuecomment-222379916
*/
PropTypes.shape({
type: PropTypes.oneOf([ListBoxMenuItem]),
}),
PropTypes.bool, // used in Dropdown for closed state
]),

/**
* Specify a custom `id`
Expand Down

0 comments on commit e2dd10f

Please sign in to comment.