Skip to content

Commit a258e0b

Browse files
committed
fix(bar): pass renderWrapper prop to container
1 parent cec89ff commit a258e0b

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

packages/bar/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ declare module '@nivo/bar' {
134134
legends: ({ dataFrom: 'indexes' | 'keys' } & LegendProps)[]
135135

136136
markers: CartesianMarkerProps[]
137+
138+
renderWrapper: boolean
137139
}>
138140

139141
export type BarLayerType = 'grid' | 'axes' | 'bars' | 'markers' | 'legends'

packages/bar/src/Bar.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ const Bar = props => {
112112
motionStiffness,
113113
motionDamping,
114114

115+
renderWrapper,
115116
role,
116117
} = props
117118
const generateBars = groupMode === 'grouped' ? generateGroupedBars : generateStackedBars
@@ -163,11 +164,7 @@ const Bar = props => {
163164

164165
return (
165166
<LegacyContainer
166-
isInteractive={isInteractive}
167-
theme={theme}
168-
animate={animate}
169-
motionStiffness={motionStiffness}
170-
motionDamping={motionDamping}
167+
{...{ animate, isInteractive, motionStiffness, motionDamping, renderWrapper, theme }}
171168
>
172169
{({ showTooltip, hideTooltip }) => {
173170
const commonProps = {

packages/bar/src/BarCanvas.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,18 @@ class BarCanvas extends Component {
262262
}
263263

264264
render() {
265-
const { outerWidth, outerHeight, pixelRatio, isInteractive, theme, canvasRef } = this.props
265+
const {
266+
outerWidth,
267+
outerHeight,
268+
pixelRatio,
269+
isInteractive,
270+
renderWrapper,
271+
theme,
272+
canvasRef,
273+
} = this.props
266274

267275
return (
268-
<LegacyContainer isInteractive={isInteractive} theme={theme} animate={false}>
276+
<LegacyContainer {...{ isInteractive, renderWrapper, theme }} animate={false}>
269277
{({ showTooltip, hideTooltip }) => (
270278
<canvas
271279
ref={surface => {

packages/bar/src/props.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export const BarPropTypes = {
9494
})
9595
).isRequired,
9696

97+
renderWrapper: PropTypes.bool,
9798
pixelRatio: PropTypes.number.isRequired,
9899
}
99100

0 commit comments

Comments
 (0)