Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable inline styles #1882

Merged
merged 12 commits into from
Jun 23, 2021
Prev Previous commit
Next Next commit
Update victory pie and polar axis
  • Loading branch information
Becca Bailey committed Jun 15, 2021
commit 5cf772d0f51aa2c11cbfb4b35db4291fdfaf5cf7
1 change: 1 addition & 0 deletions packages/victory-pie/src/victory-pie.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class VictoryPie extends React.Component {
cornerRadius: PropTypes.oneOfType([CustomPropTypes.nonNegative, PropTypes.func]),
data: PropTypes.array,
dataComponent: PropTypes.element,
disableInlineStyes: PropTypes.bool,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for this work to be complete for VictoryPie, you'll also need to pass the disableInlineStyles prop through to Slice component via data props here: https://github.com/FormidableLabs/victory/blob/main/packages/victory-pie/src/helper-methods.js#L249

You could also save a bit of work here: https://github.com/FormidableLabs/victory/blob/main/packages/victory-pie/src/helper-methods.js#L259

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think passing through the disableInlineStyles prop for VictoryLabel would be taken care of in LabelHelpers.getProps

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

endAngle: PropTypes.number,
eventKey: PropTypes.oneOfType([
PropTypes.func,
Expand Down
3 changes: 3 additions & 0 deletions packages/victory-polar-axis/src/helper-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ const getScale = (props) => {
};

const getStyles = (props, styleObject) => {
if (props.disableInlineStyles) {
return {};
}
const style = props.style || {};
styleObject = styleObject || {};
const parentStyleProps = { height: "auto", width: "100%" };
Expand Down
1 change: 1 addition & 0 deletions packages/victory-polar-axis/src/victory-polar-axis.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class VictoryPolarAxis extends React.Component {
circularGridComponent: PropTypes.element,
containerComponent: PropTypes.element,
dependentAxis: PropTypes.bool,
disableInlineStyles: PropTypes.bool,
endAngle: PropTypes.number,
events: PropTypes.arrayOf(
PropTypes.shape({
Expand Down