indexiatech / re-notif

Redux & React based Notifications center.

Home Page:http://indexiatech.github.io/re-notif

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warning message on Custom Component rendering

tarhunakau opened this issue · comments

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

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!!

@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?

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.

commented

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])

commented

Sorry, just experimenting with my repo