brimdata / react-arborist

The complete tree view component for React
MIT License
3.04k stars 138 forks source link

How can we use `renderContainer`? #52

Open donnguyen opened 2 years ago

donnguyen commented 2 years ago

Hi there,

I am trying to write a custom container for our tree but can't find any document on renderContainer? Just reading the code, the renderContainer provides no tree-api access, so not sure if it is even possible to have a custom one?

Thanks for the great works!

Cheers

jameskerr commented 2 years ago

Hi @donnguyen, I didn't document it because I wasn't sure if should be public api yet. I think the way it currently exists, it's not difficult and awkward to make a custom one. The default has too many internal dependencies.

What are your needs for a custom container? I would guess you want to control the keyboard shortcuts?

donnguyen commented 2 years ago

Hi @jameskerr, thanks for getting back to me.

We would need more than just the keyboard shortcuts. Actually we are having many small issues with the UI, how the absolute position works. You know, it is good, but not so great, we don't want the x scrollbar etc. We are trying to do something like Google Drive doing with their sidebar, it can automatically increase the width to fit the tree if necessary. It is not so easy to do with absolute position. I know all these come from FixedSizeList, not react-arborist itself, so I am just trying to customise the container to go with something like https://github.com/petyosi/react-virtuoso. I guess it might help.

jameskerr commented 2 years ago

@donnguyen sounds good. With the right css styling I'm able to make the tree items expand to fill their container. Here's a demo page: https://react-arborist.netlify.app/cities