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
[BottomNavigation] Allow null bottom navigation items #9011
Conversation
@@ -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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
@ciroja Thank you! |
* Allow null bottom navigation items * Update BottomNavigation.spec.js * Prettifying * Prettifying * removig spaces * removing spaces * using isValidElement
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.