Skip to content

Commit

Permalink
fix(bar): pass renderWrapper prop to container
Browse files Browse the repository at this point in the history
  • Loading branch information
wyze committed May 22, 2021
1 parent cec89ff commit a258e0b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions packages/bar/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ declare module '@nivo/bar' {
legends: ({ dataFrom: 'indexes' | 'keys' } & LegendProps)[]

markers: CartesianMarkerProps[]

renderWrapper: boolean
}>

export type BarLayerType = 'grid' | 'axes' | 'bars' | 'markers' | 'legends'
Expand Down
7 changes: 2 additions & 5 deletions packages/bar/src/Bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const Bar = props => {
motionStiffness,
motionDamping,

renderWrapper,
role,
} = props
const generateBars = groupMode === 'grouped' ? generateGroupedBars : generateStackedBars
Expand Down Expand Up @@ -163,11 +164,7 @@ const Bar = props => {

return (
<LegacyContainer
isInteractive={isInteractive}
theme={theme}
animate={animate}
motionStiffness={motionStiffness}
motionDamping={motionDamping}
{...{ animate, isInteractive, motionStiffness, motionDamping, renderWrapper, theme }}
>
{({ showTooltip, hideTooltip }) => {
const commonProps = {
Expand Down
12 changes: 10 additions & 2 deletions packages/bar/src/BarCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,18 @@ class BarCanvas extends Component {
}

render() {
const { outerWidth, outerHeight, pixelRatio, isInteractive, theme, canvasRef } = this.props
const {
outerWidth,
outerHeight,
pixelRatio,
isInteractive,
renderWrapper,
theme,
canvasRef,
} = this.props

return (
<LegacyContainer isInteractive={isInteractive} theme={theme} animate={false}>
<LegacyContainer {...{ isInteractive, renderWrapper, theme }} animate={false}>
{({ showTooltip, hideTooltip }) => (
<canvas
ref={surface => {
Expand Down
1 change: 1 addition & 0 deletions packages/bar/src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const BarPropTypes = {
})
).isRequired,

renderWrapper: PropTypes.bool,
pixelRatio: PropTypes.number.isRequired,
}

Expand Down

0 comments on commit a258e0b

Please sign in to comment.