Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sanity check] PropTypes.oneOfType([PropTypes.element, PropTypes.func]) replaced with PropTypes.elementType #2737

Open
adamstankiewicz opened this issue Oct 20, 2023 · 2 comments
Assignees

Comments

@adamstankiewicz
Copy link
Member

adamstankiewicz commented Oct 20, 2023

Example component where issue is seen:

DataTable supports a columns prop that allows consumers to customize their table's column configuration. For each column, consumers may override the Cell property within react-table to customize the display and bring in custom UI elements / formatting.

Currently, the Cell property accepts a prop type similar to PropTypes.oneOfType([PropTypes.element, PropTypes.func]). However, this does not support passing an element type, i.e. just the component name.

<DataTable
  columns={[
    {
      id: 'testColumn',
      Cell: TestTableColumnCell,
    },
  ]}
/>

where TestTableColumnCell might be the following, for example:

function TestTableColumnCell({ row }) {
  return `${row.original.firstName} ${row.original.lastName}`;
}
@adamstankiewicz adamstankiewicz changed the title PropTypes for DataTable [sanity check] PropTypes.oneOfType([PropTypes.element, PropTypes.func]) replaced with PropTypes.elementType Oct 20, 2023
@adamstankiewicz adamstankiewicz moved this from Backlog to To Do in Paragon Working Group Oct 20, 2023
@monteri monteri moved this from To Do to In review in Paragon Working Group Oct 31, 2023
@monteri monteri self-assigned this Oct 31, 2023
@monteri
Copy link
Contributor

monteri commented Oct 31, 2023

#2749

@PKulkoRaccoonGang PKulkoRaccoonGang moved this from In review to Done in Paragon Working Group Dec 8, 2023
@viktorrusakov
Copy link
Contributor

@PKulkoRaccoonGang please check other components for the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

3 participants