From 3c5514ab75f30f5da1443db56f6f08cbf7a60c94 Mon Sep 17 00:00:00 2001 From: Ivan Vezhnavets Date: Sun, 28 Mar 2021 15:45:46 +0300 Subject: [PATCH 1/2] feat(menuGroup): add expanded example & fix props for groups --- .../menu/menu-showcase.component.tsx | 2 +- src/scenes/components/menu/type.tsx | 33 ++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/scenes/components/menu/menu-showcase.component.tsx b/src/scenes/components/menu/menu-showcase.component.tsx index 3d7b07c2..97a4153e 100644 --- a/src/scenes/components/menu/menu-showcase.component.tsx +++ b/src/scenes/components/menu/menu-showcase.component.tsx @@ -12,7 +12,7 @@ export const MenuShowcase = (props: MenuShowcaseProps): MenuElement => { const renderData: MenuElement[] = props.data.map((el, index) => ( el.subItems ? ( - + {el.subItems.map((el, index) => ( ))} diff --git a/src/scenes/components/menu/type.tsx b/src/scenes/components/menu/type.tsx index c11fc6b6..1bd967e7 100644 --- a/src/scenes/components/menu/type.tsx +++ b/src/scenes/components/menu/type.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { ImageStyle } from 'react-native' import { IconElement, MenuProps } from '@ui-kitten/components'; import { StarIcon } from '../../../components/icons'; @@ -13,6 +12,7 @@ interface MenuType { title: string; accessoryLeft?: (style: ImageStyle) => IconElement; disabled?: boolean; + expanded?: boolean; } export interface MenuShowcaseProps extends MenuProps { @@ -90,6 +90,29 @@ const withGroupsMenuItems: MenuGroupType[] = [ }, ]; +const withGroupsExpandedMenuItems: MenuGroupType[] = [ + { + title: 'Item 1', + accessoryLeft: StarIcon, + expanded: true, + subItems: [ + { + title: 'Item 11', + accessoryLeft: StarIcon, + disabled: true, + }, + { + title: 'Item 12', + accessoryLeft: StarIcon, + }, + { + title: 'Item 13', + accessoryLeft: StarIcon, + }, + ], + } +]; + const defaultMenu: ComponentShowcaseItem = { title: 'Default', props: { @@ -127,10 +150,18 @@ const withGroupsMenu: ComponentShowcaseItem = { }, }; +const withExpandedGroupsMenu: ComponentShowcaseItem = { + title: 'Default expand', + props: { + data: withGroupsExpandedMenuItems, + }, +}; + const withGroupsSection: ComponentShowcaseSection = { title: 'With Groups', items: [ withGroupsMenu, + withExpandedGroupsMenu, ], }; From 1ae680e9619434fee43f5eb7b486508e8b9cf9f5 Mon Sep 17 00:00:00 2001 From: Ivan Vezhnavets Date: Mon, 29 Mar 2021 19:00:34 +0300 Subject: [PATCH 2/2] update(menuGroup): change prop naming related to kitten fix --- src/scenes/components/menu/type.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scenes/components/menu/type.tsx b/src/scenes/components/menu/type.tsx index 1bd967e7..f74a7f96 100644 --- a/src/scenes/components/menu/type.tsx +++ b/src/scenes/components/menu/type.tsx @@ -12,7 +12,7 @@ interface MenuType { title: string; accessoryLeft?: (style: ImageStyle) => IconElement; disabled?: boolean; - expanded?: boolean; + initialExpanded?: boolean; } export interface MenuShowcaseProps extends MenuProps { @@ -94,7 +94,7 @@ const withGroupsExpandedMenuItems: MenuGroupType[] = [ { title: 'Item 1', accessoryLeft: StarIcon, - expanded: true, + initialExpanded: true, subItems: [ { title: 'Item 11',