Git Product home page Git Product logo

Comments (4)

Cowjiang avatar Cowjiang commented on June 12, 2024

and no issue if I don't use ListboxSection , like the example in document - Listbox -> ListboxItem
the issue only produce on Listbox -> ListboxSection -> ListboxItem

from nextui.

yahorbarkouski avatar yahorbarkouski commented on June 12, 2024

hey @Cowjiang, perhaps you have found a solution already?

from nextui.

Cowjiang avatar Cowjiang commented on June 12, 2024

hey @Cowjiang, perhaps you have found a solution already?

Not yet, just add @ts-ignore : (

from nextui.

ahmadbafrani avatar ahmadbafrani commented on June 12, 2024

I have the same issue when using ListboxSection with dynamic items.

<Listbox aria-label='Page selection' > <ListboxSection items={items}> {(item) => ( <ListboxItem key={item.key} > {item.title} </ListboxItem> )} </ListboxSection> </Listbox>

Type '(item: { key: string; title: string; }) => Element' is not assignable to type '(ItemElement<{ key: string; title: string; }> | ItemElement<{ key: string; title: string; }>[] | ItemRenderer<{ key: string; title: string; }>) & ReactNode'.
Type '(item: { key: string; title: string; }) => Element' is not assignable to type 'ItemRenderer<{ key: string; title: string; }> & string'.
Type '(item: { key: string; title: string; }) => Element' is not assignable to type 'string'.ts(2322)

As mentioned in ListboxSection document, children prop accepts ReactNode, so I changed the code to this and the error is gone:
<Listbox aria-label='Page selection' > <ListboxSection> {items.map((item) => ( <ListboxItem key={item.key} > {item.title} </ListboxItem> ))} </ListboxSection> </Listbox>

from nextui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.