Skip to content

Commit

Permalink
fix(Grid): The style prop of Col in the Grid does not take effect
Browse files Browse the repository at this point in the history
  • Loading branch information
sunqiangqiang.sqq committed Sep 23, 2024
1 parent b78641b commit 5c1721d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 12 additions & 0 deletions components/grid/__tests__/index-spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,16 @@ describe('Issues', () => {
cy.get('.next-col').should('not.have.attr', key.toLowerCase());
});
});

//https://github.com/alibaba-fusion/next/issues/4908
it('should child element receiver style props', () => {
cy.mount(
<Row>
<Col span={4} style={{ color: 'red' }}>
color red
</Col>
</Row>
);
cy.get('.next-col').should('have.css', 'color', 'rgb(255, 0, 0)');
});
});
3 changes: 1 addition & 2 deletions components/grid/row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ export default class Row extends Component<RowProps> {
style: {
paddingLeft: halfGutterString,
paddingRight: halfGutterString,
// @ts-expect-error 只有 dom 才有 style 属性
...(child.style || {}),
...(child.props.style || {}),
},
});
return newChild;
Expand Down

0 comments on commit 5c1721d

Please sign in to comment.