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

Warning on unknown props since React 15.2.1 #296

Closed
PEM-- opened this issue Jul 13, 2016 · 2 comments
Closed

Warning on unknown props since React 15.2.1 #296

PEM-- opened this issue Jul 13, 2016 · 2 comments

Comments

@PEM--
Copy link

PEM-- commented Jul 13, 2016

Here's the warning:

Warning: Unknown props `lineHeight`, `events`, `slice`, `text`, `index`, `datum`, `verticalAnchor`, `angle` on <text> tag.

Do you know how I could filter these props?

@kumarharsh
Copy link

I'm getting similar warnings for <VictoryGroup>:

Warning: Unknown props `parent`, `events` on <g> tag. Remove these props from the element. For details, see https://fb.me/react-unknown-prop
    in g
    in VictorySharedEvents (created by VictoryGroup)
    in VictoryGroup (created by VictoryChart)
    in g
    in svg (created by VictoryContainer)
    in VictoryContainer (created by VictoryChart)
    in VictoryChart (created by MyOwnGraphComponent)

@kumarharsh
Copy link

I think the simplest way would be to just check if the default element is being used (like the <g> in case of VictorySharedEvents set in defaultProps), and filter out all the superfluous props.

Something like:

getContainer(props, children) {
  ...
  if (!this.props.container) {
    usingDefaultComponent = true;
  }
  const container = this.props.container || this.props.groupComponent;
  ...
  return React.cloneElement(
      container,
      assign(
        {}, parentProps, usingDefaultComponent ? {} : {events: Events.getPartialEvents(parentEvents, "parent", parentProps)}
      ),
      children
    );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants