indexiatech / re-notif

Redux & React based Notifications center.
http://indexiatech.github.io/re-notif
BSD 3-Clause "New" or "Revised" License
148 stars 45 forks source link

Warning message on Custom Component rendering #22

Closed tarhunakau closed 8 years ago

tarhunakau commented 8 years ago

Warning: Failed propType: Invalid prop CustomComponent supplied to Notif, expected a ReactNode. Check the render method of Notifs.

This message appears when Custom Component renders. Also it appears in Demo of this component.

React: 15.0.2 Redux: 3.5.2 React-Redux: 4.4.5

f3arnil commented 8 years ago

My colleague was ahead of me... :) I have the same problem with CustomComponent. I spend the day trying to solve this problem but the warning remains.

Warning: Failed propType: Invalid prop CustomComponent supplied to Notif, expected a ReactNode. Check the render method of Notifs.

Moreover, I have the same warning on your demo!!

kylecesmat commented 8 years ago

@BLRplex @f3arnil I'll investigate this. Theres a slight chance we introduced a bug with the amount of changes we made to the latest release.

What are you passing as CustomComponent - It is a react object/component, correct?

tarhunakau commented 8 years ago

Yes, correct. My code is next:


class Message extends Component {
    ...
    render() { return ... }
}

<Notifs CustomComponent={ Message } ... />

When I launched your demo the warning message appears too.

steplerbox commented 8 years ago

PropType should be React.PropTypes.func because you pass just a function. https://facebook.github.io/react/docs/reusable-components.html#stateless-functions

I'm not sure about React.PropTypes.node and React.PropTypes.element, but we can use React.PropTypes.oneOfType([React.PropTypes.func, React.PropTypes.node, React.PropTypes.element])

steplerbox commented 8 years ago

Sorry, just experimenting with my repo