@@ -219,7 +219,8 @@ If you want to use a custom component as your <Content />, you can use the creat
219219 `[zeego] Invalid <${ Menu } .Item key="${ key } " /> Missing valid title. Make sure you do one of the following:
220220
2212211. pass a string as the child of <${ Menu } .ItemTitle />, nested directly inside of <${ Menu } .Item />.
222- 2. OR, use the textValue prop on <${ Menu } .Item textValue="Some value" />`
222+ 2. OR, use the textValue prop on <${ Menu } .Item textValue="Some value" />
223+ 3. OR, if you are using a horizontal Group with icons only, pass an empty string: <${ Menu } .ItemTitle textValue="" />`
223224 )
224225 }
225226
@@ -284,7 +285,7 @@ If you want to use a custom component as your <Content />, you can use the creat
284285 }
285286 }
286287 }
287- if ( title ) {
288+ if ( typeof title == 'string' ) {
288289 const maybeIndexKey =
289290 typeof child . key == 'string' && child . key . startsWith ( '.' )
290291 ? child . key . substring ( 1 )
@@ -324,16 +325,14 @@ If you want to use a custom component as your <Content />, you can use the creat
324325 icon,
325326 }
326327 }
327- return
328+ return undefined
328329 }
329330
330331 const mapItemsChildren = (
331332 children : React . ReactNode
332333 ) : ( ( MenuItem | MenuConfig ) | null ) [ ] => {
333- return Children . map ( flattenChildren ( children ) , ( _child , index ) => {
334- if ( isInstanceOfComponent ( _child , Item ) ) {
335- const child = _child
336-
334+ return Children . map ( flattenChildren ( children ) , ( child , index ) => {
335+ if ( isInstanceOfComponent ( child , Item ) ) {
337336 const item = getItemFromChild ( child , index )
338337 if ( item ) {
339338 const { icon, title, key, menuAttributes, subtitle } = item
@@ -346,9 +345,7 @@ If you want to use a custom component as your <Content />, you can use the creat
346345 }
347346 return finalItem
348347 }
349- } else if ( isInstanceOfComponent ( _child , CheckboxItem ) ) {
350- const child = _child
351-
348+ } else if ( isInstanceOfComponent ( child , CheckboxItem ) ) {
352349 const item = getItemFromChild ( child , index )
353350 if ( item ) {
354351 const { icon, title, key, menuAttributes, subtitle } = item
@@ -370,8 +367,7 @@ If you want to use a custom component as your <Content />, you can use the creat
370367 }
371368 return finalItem
372369 }
373- } else if ( isInstanceOfComponent ( _child , Sub ) ) {
374- const child = _child
370+ } else if ( isInstanceOfComponent ( child , Sub ) ) {
375371 const triggerItemChild = pickChildren < MenuSubTriggerProps > (
376372 child . props . children ,
377373 SubTrigger
@@ -408,9 +404,7 @@ If you want to use a custom component as your <Content />, you can use the creat
408404 }
409405 }
410406 }
411- } else if ( isInstanceOfComponent ( _child , Group ) ) {
412- const child = _child as ReactElement < MenuGroupProps >
413-
407+ } else if ( isInstanceOfComponent ( child , Group ) ) {
414408 const groupItems = mapItemsChildren ( child . props . children ) . filter (
415409 filterNull
416410 )
0 commit comments