Skip to content

Commit

Permalink
fix: fix React.Fragment complaining about width/height (apache#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw authored and zhaoyongjie committed Nov 24, 2021
1 parent a838115 commit 3620eb4
Showing 1 changed file with 23 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,29 +116,34 @@ export default class SuperChart extends React.PureComponent<Props, {}> {
disableErrorBoundary,
FallbackComponent,
onErrorBoundary,
Wrapper = React.Fragment,
Wrapper,
...rest
} = this.props as PropsWithDefault;

const chart = (
const chartWithoutWrapper = (
<SuperChartCore
ref={this.setRef}
id={id}
className={className}
chartType={chartType}
chartProps={this.createChartProps({
...rest,
height,
width,
})}
preTransformProps={preTransformProps}
overrideTransformProps={overrideTransformProps}
postTransformProps={postTransformProps}
onRenderSuccess={onRenderSuccess}
onRenderFailure={onRenderFailure}
/>
);
const chart = Wrapper ? (
<Wrapper width={width} height={height}>
<SuperChartCore
ref={this.setRef}
id={id}
className={className}
chartType={chartType}
chartProps={this.createChartProps({
...rest,
height,
width,
})}
preTransformProps={preTransformProps}
overrideTransformProps={overrideTransformProps}
postTransformProps={postTransformProps}
onRenderSuccess={onRenderSuccess}
onRenderFailure={onRenderFailure}
/>
{chartWithoutWrapper}
</Wrapper>
) : (
chartWithoutWrapper
);

// Include the error boundary by default unless it is specifically disabled.
Expand Down

0 comments on commit 3620eb4

Please sign in to comment.