diff --git a/packages/vkui/src/components/SubnavigationBar/SubnavigationBar.test.tsx b/packages/vkui/src/components/SubnavigationBar/SubnavigationBar.test.tsx
index 396d89b9e7..c746c7a162 100644
--- a/packages/vkui/src/components/SubnavigationBar/SubnavigationBar.test.tsx
+++ b/packages/vkui/src/components/SubnavigationBar/SubnavigationBar.test.tsx
@@ -1,6 +1,25 @@
+import * as React from 'react';
+import { render, screen } from '@testing-library/react';
import { baselineComponent } from '../../testing/utils';
+import { SubnavigationButton } from '../SubnavigationButton/SubnavigationButton';
import { SubnavigationBar } from './SubnavigationBar';
describe('SubnavigationBar', () => {
baselineComponent(SubnavigationBar);
+
+ it('Does not render falsy children', () => {
+ const falseCondition = false;
+ const trueCondition = true;
+ render(
+
+ Сканировать
+ {null}
+ {trueCondition && Добавить}
+ {false}
+ {falseCondition && Удалить}
+ ,
+ );
+
+ expect(screen.getAllByRole('listitem').length).toEqual(2);
+ });
});
diff --git a/packages/vkui/src/components/SubnavigationBar/SubnavigationBar.tsx b/packages/vkui/src/components/SubnavigationBar/SubnavigationBar.tsx
index ae63071ae5..c8b2dff5f0 100644
--- a/packages/vkui/src/components/SubnavigationBar/SubnavigationBar.tsx
+++ b/packages/vkui/src/components/SubnavigationBar/SubnavigationBar.tsx
@@ -1,4 +1,5 @@
import * as React from 'react';
+import { hasReactNode } from '@vkontakte/vkjs';
import { HTMLAttributesWithRootRef } from '../../types';
import {
HorizontalScroll,
@@ -55,11 +56,13 @@ export const SubnavigationBar = ({
>
- {React.Children.map(children, (child, idx) => (
- -
- {child}
-
- ))}
+ {React.Children.map(children, (child, idx) =>
+ hasReactNode(child) ? (
+ -
+ {child}
+
+ ) : null,
+ )}