Skip to content

Commit

Permalink
fix: support mobileOptions.render function components allowed in its …
Browse files Browse the repository at this point in the history
…prop types
  • Loading branch information
tkajtoch committed Jul 25, 2023
1 parent 9d99f39 commit b664f36
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src-docs/src/views/tables/custom/custom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,14 @@ export default class extends Component<{}, State> {
child = cell;
}

// mobileOptions.render can be either ReactNode or function component
let mobileOptionsRender: ReactNode;
if (typeof column.mobileOptions?.render === 'function') {
mobileOptionsRender = column.mobileOptions?.render(item);
} else {
mobileOptionsRender = column.mobileOptions?.render;
}

return (
<EuiTableRowCell
key={column.id}
Expand All @@ -674,6 +682,7 @@ export default class extends Component<{}, State> {
mobileOptions={{
header: column.label,
...column.mobileOptions,
render: mobileOptionsRender,
}}
>
{child}
Expand Down

0 comments on commit b664f36

Please sign in to comment.