function makeFlexible(Component, isWidthFlexible, isHeightFlexible) {
  const ResultClass = class extends React.Component {
    static get propTypes() {
      const {height, width, ...otherPropTypes} = Component.propTypes; // eslint-disable-line no-unused-vars
      return otherPropTypes;
    }

    constructor(props) {
      super(props);
      this.state = {
        height: 0,
        width: 0
      };
    }

    /**
     * Get the width of the container and assign the width.
     * @private
     */
    _onResize = () => {
      const containerElement = getDOMNode(this[CONTAINER_REF]);
      const {offsetHeight, offsetWidth} = containerElement;

      const newHeight =
        this.state.height === offsetHeight ? {} : {height: offsetHeight};

      const newWidth =
        this.state.width === offsetWidth ? {} : {width: offsetWidth};

      this.setState({
        ...newHeight,
        ...newWidth
      });
    };

    componentDidMount() {
      this._onResize();
      this.cancelSubscription = subscribeToDebouncedResize(this._onResize);
    }

    UNSAFE_componentWillReceiveProps() {
      this._onResize();
    }

    componentWillUnmount() {
      this.cancelSubscription();
    }

    render() {
      const {height, width} = this.state;
      const props = {
        ...this.props,
        animation: height === 0 && width === 0 ? null : this.props.animation
      };

      const updatedDimensions = {
        ...(isHeightFlexible ? {height} : {}),
        ...(isWidthFlexible ? {width} : {})
      };

      return (
        <div
          ref={ref => (this[CONTAINER_REF] = ref)}
          style={{width: '100%', height: '100%'}}
        >
          <Component {...updatedDimensions} {...props} />
        </div>
      );
    }
  };

  ResultClass.displayName = `Flexible${getDisplayName(Component)}`;

  return ResultClass;
}
Add the ability to stretch the visualization on window resize.
@param {*} Component React class for the child component.
@returns {*} Flexible component.