import React, { Children } from 'react';
import PropTypes from 'prop-types';

import Context from './context';
import Notification from './notification';

class Provider extends React.PureComponent {
  constructor(props) {
    super(props);

    this.showNotification = this.showNotification.bind(this);
  }

  showNotification(notificationOptions) {
    if (this.notification) {
      this.notification.show(notificationOptions);
    }
  }

  render() {
    return (
      <Context.Provider value={this.showNotification}>
        {Children.only(this.props.children)}
        <Notification
          ref={(ref) => {
            this.notification = ref;
          }}
          {...this.props}
        />
      </Context.Provider>
    );
  }
}

Provider.propTypes = {
  ...Notification.propTypes,
  children: PropTypes.element.isRequired,
};

export default Provider;

import React, { Children } from 'react';
import PropTypes from 'prop-types';

import Context from './context';
import Notification from './notification';

class Provider extends React.PureComponent {
  constructor(props) {
    super(props);

    this.showNotification = this.showNotification.bind(this);
  }

  showNotification(notificationOptions) {
    if (this.notification) {
      this.notification.show(notificationOptions);
    }
  }

  render() {
    return (
      <Context.Provider value={this.showNotification}>
        {Children.only(this.props.children)}
        <Notification
          ref={(ref) => {
            this.notification = ref;
          }}
        />
      </Context.Provider>
    );
  }
}

Provider.propTypes = {
  children: PropTypes.element.isRequired,
};

export default Provider;

--- 
+++ 
@@ -25,7 +25,6 @@
           ref={(ref) => {
             this.notification = ref;
           }}
-          {...this.props}
         />
       </Context.Provider>
     );
@@ -33,7 +32,6 @@
 }
 
 Provider.propTypes = {
-  ...Notification.propTypes,
   children: PropTypes.element.isRequired,
 };
 
feat(Provider): Allow passing props to 'Notification' through 'Provider'
