Skip to content

Commit e4abeb0

Browse files
committed
feat: Fixed RenderToBody wrong attribute name
1 parent e9bda35 commit e4abeb0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

docs/src/routes/Home/components/Categories.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ function getStyles(categories: Categories): {
109109
const { prefixStyle } = theme;
110110

111111
return {
112-
root: prefixStyle({
113-
...style
114-
}),
112+
root: prefixStyle(style),
115113
categories: prefixStyle({
116114
width: renderContentWidth,
117115
display: "flex",

src/RenderToBody.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export default class RenderToBody extends React.Component<RenderToBodyProps> {
1111
rootElm = document.createElement("div");
1212
componentDidMount() {
1313
const { style, className } = this.props;
14-
Object.assign(this.rootElm, className ? { style, className } : { style });
14+
Object.assign(this.rootElm.style, style);
15+
if (className) this.rootElm.setAttribute("class", className);
1516

1617
document.body.appendChild(this.rootElm);
1718
this.renderComponent();
@@ -20,7 +21,8 @@ export default class RenderToBody extends React.Component<RenderToBodyProps> {
2021
componentDidUpdate() {
2122
this.renderComponent();
2223
const { style, className } = this.props;
23-
Object.assign(this.rootElm, className ? { style, className } : { style });
24+
Object.assign(this.rootElm.style, style);
25+
if (className) this.rootElm.setAttribute("class", className);
2426
}
2527

2628
componentWillUnmount() {

0 commit comments

Comments
 (0)