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

fix: Support for React 19 with defaultProps #1869

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions source/Table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import Grid, {accessibilityOverscanIndicesGetter} from '../Grid';
import defaultRowRenderer from './defaultRowRenderer';
import defaultHeaderRowRenderer from './defaultHeaderRowRenderer';
import SortDirection from './SortDirection';
import defaultCellDataGetter from './defaultCellDataGetter';
import defaultCellRenderer from './defaultCellRenderer';

/**
* Table component with fixed headers and virtualized rows for improved performance with large data sets.
Expand Down Expand Up @@ -455,8 +457,8 @@ export default class Table extends React.PureComponent {
_createColumn({column, columnIndex, isScrolling, parent, rowData, rowIndex}) {
const {onColumnClick} = this.props;
const {
cellDataGetter,
cellRenderer,
cellDataGetter = defaultCellDataGetter,
cellRenderer = defaultCellRenderer,
className,
columnData,
dataKey,
Expand Down Expand Up @@ -513,9 +515,9 @@ export default class Table extends React.PureComponent {
const {
columnData,
dataKey,
defaultSortDirection,
defaultSortDirection = Column.defaultProps.defaultSortDirection,
disableSort,
headerRenderer,
headerRenderer = Column.defaultProps.headerRenderer,
id,
label,
} = column.props;
Expand Down Expand Up @@ -674,7 +676,9 @@ export default class Table extends React.PureComponent {
* Determines the flex-shrink, flex-grow, and width values for a cell (header or column).
*/
_getFlexStyleForColumn(column, customStyle = {}) {
const flexValue = `${column.props.flexGrow} ${column.props.flexShrink} ${column.props.width}px`;
const flexValue = `${column.props.flexGrow ||
Column.defaultProps.flexGrow} ${column.props.flexShrink ||
Column.defaultProps.flexShrink} ${column.props.width}px`;

const style = {
...customStyle,
Expand Down