Skip to content

Commit

Permalink
fix(Table): style conflict with align
Browse files Browse the repository at this point in the history
error occurs when set props 'style' and 'align' both on Table.Column.
  • Loading branch information
闻驰 committed Dec 26, 2018
1 parent a494a9d commit aa32515
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/table/base/cell.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export default class Cell extends React.Component {
/* eslint-disable no-unused-vars */
const {prefix, className, cell, value, resizable, colIndex, rowIndex, record, context, align, style = {}, component: Tag,
children, title, width, innerStyle, primaryKey, __normalized, filterMode, filters, sortable, lock, pure, ...others} = this.props;
const tagStyle = {...style};
const cellProps = {value, index: rowIndex, record, context};
let content = cell;
if (React.isValidElement(content)) {
Expand All @@ -58,14 +59,14 @@ export default class Cell extends React.Component {
content = content(value, rowIndex, record, context);
}
if (align) {
style.textAlign = align;
tagStyle.textAlign = align;
}
const cls = classnames({
[`${prefix}table-cell`]: true,
[className]: className
});

return (<Tag {...others} className={cls} style={style} role="gridcell">
return (<Tag {...others} className={cls} style={tagStyle} role="gridcell">
<div className={`${prefix}table-cell-wrapper`} style={innerStyle}>
{content}
{children}
Expand Down

0 comments on commit aa32515

Please sign in to comment.