-
Notifications
You must be signed in to change notification settings - Fork 973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Layout warns when wrapping Panel/NavDrawer/Sidebar in custom component #641
Comments
I just had the same kind of error. I believe react-toolbox is explicitly expecting either a NavDrawer or Sidebar to precede a Panel, any other component would output that warning. You would also get a warning if you changed the order of the components, to something like Panel, Sidebar & then NavDrawer. Note: Explicitly importing the components as follows: import Layout from 'react-toolbox/lib/layout/layout';
import NavDrawer from 'react-toolbox/lib/drawer';
import Panel from 'react-toolbox/lib/layout/panel'; as opposed to importing them as in the React-Toolbox example: import { Layout, NavDrawer, Panel, Sidebar } from 'react-toolbox'; would also give you the same warning. |
Seems to me that this error message is overly aggressive, treating the developer as a bit of an idiot. |
I just ran into this message. There should be a better way than checking the component name: https://github.com/react-toolbox/react-toolbox/blob/dev/components/layout/Layout.js#L12 One way to work around it would be to set your displayName to NavDrawer or Sidebar. However this becomes tricky if you are using any sort of higher order components such as redux connect. It also defeats the debugging utility of component names. I would propose removing this warning all together it is pretty visually obvious when the components are in the wrong order. What do you think? I can put together a PR if you guys agree. |
I'm leaning towards removing the warning entirely. You should be able to On 24 Aug 2016 3:48 pm, "Andrew Sprouse" [email protected] wrote:
|
Agree, if the warning it's annoying we can just remove it. It's a matter of styling and you may guess it's wrong as @InfernoZeus Enough warning in the docs IMO |
Remove overly strict children propType validation. fixes #641
I'm trying to wrap the NavDrawer in a custom component which accepts a list of menu items. When doing this, Layout warns that it only accepts Panel as a child, with optional NavDrawer and Sidebar:
My layout has a NavMenu component, which is causing the issue:
The text was updated successfully, but these errors were encountered: