JesperLekland / react-native-svg-charts

📈 One library to rule all charts for React Native 📊
MIT License
2.36k stars 409 forks source link

Annoying warnings because of props littering #596

Open EmilRais opened 1 year ago

EmilRais commented 1 year ago

What is the problem?

It's super annoying that the following file: https://github.com/JesperLekland/react-native-svg-charts/blob/dev/src/animated-path.js

Passes its props, unfiltered, to "react-native-svg"'s Path so that the props end up in the dom. That triggers 3 super large warnings in the console on web based browsers. One for "animate", "animationDuration", and "renderPlaceholder".

It's easy to fix, just do the following:

const { animate, animationDuration, renderPlaceholder, ...otherProps } = this.props;

return (
    <Path
        ref={(ref) => (this.component = ref)}
        {...otherProps}
        d={this.props.animate ? this.state.d : this.props.d}
    />
);
brduck commented 1 year ago

Same error here!