Skip to content
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

[BottomNavigation] Allow null bottom navigation items #9011

Merged
merged 7 commits into from Nov 6, 2017
Merged

[BottomNavigation] Allow null bottom navigation items #9011

merged 7 commits into from Nov 6, 2017

Conversation

ciroja
Copy link
Contributor

@ciroja ciroja commented Nov 6, 2017

There was an issue with rendering null children for BottomNavigation.
For v.0.19x it is fixed by #8925
But it seems that in v1-beta (v1.0.0-beta20) this issue still exists anyway.

This PR solves this issue.

@@ -64,6 +64,7 @@ function BottomNavigation(props: ProvidedProps & Props) {
const className = classNames(classes.root, classNameProp);

const children = React.Children.map(childrenProp, (child, childIndex) => {
if (child === null) return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using React.Children.isValidElement instead?

Copy link
Contributor Author

@ciroja ciroja Nov 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You meant if (!React.isValidElement(child)) return null; ?
Yes, that would be even better

@oliviertassinari oliviertassinari changed the title [BottomNavigation] Allow null bottom navigation items (in v1-beta) [BottomNavigation] Allow null bottom navigation items Nov 6, 2017
@oliviertassinari oliviertassinari added component: bottom navigation This is the name of the generic UI component, not the React module! new feature New feature or request labels Nov 6, 2017
@oliviertassinari oliviertassinari merged commit 2fabdb6 into mui:v1-beta Nov 6, 2017
@oliviertassinari
Copy link
Member

@ciroja Thank you!

@ciroja ciroja deleted the allow-null-bottom-nav-item branch November 6, 2017 18:46
the-noob pushed a commit to the-noob/material-ui that referenced this pull request Nov 17, 2017
* Allow null bottom navigation items

* Update BottomNavigation.spec.js

* Prettifying

* Prettifying

* removig spaces

* removing spaces

* using isValidElement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: bottom navigation This is the name of the generic UI component, not the React module! new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants