[Feature Suggestion] Expose onItemsRendered value as props to rendered cells
See original GitHub issueI have a specific use-case*, that i need to know the value that i would get from onItemsRendered
The thing is, the onItemsRendered callback is called only after the items was rendered.
I assume that, when render calls are made to render cells, the library already knows the values it will pass to onItemsRendered. as it uses them to calculate which cells to render.
So, the lib can pass it as an additional prop to the cell component.
- My use case is: I’m trying to build a grid with fixed header, footer, and left-most visual column.
Code example of what i need: https://github.com/bvaughn/react-window/compare/master...Bnaya:iterations?expand=1 I’n going to try and see if its helps me
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
A Visual Guide to React Rendering - Props - Alex Sidorenko
Let's try to pass a primitive value as a prop to the Child. The Child is wrapped in memo . This means it...
Read more >React hooks for headless table components - Morioh
This is the main hook exposed by the library and should be your entrypoint for any table functionality. Only columns and data are...
Read more >Source - GitHub
This prop lets the consumer render a hint below the search bar that will be ... to `useEuiTheme`'s return value, supporting React's shallow...
Read more >@elastic/eui: Versions | Openbase
Added the customQuickSelectRender render prop to EuiSuperDatePicker ... when the search bar is controlled and cleared using searchProps.value (#6317) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It could be implemented that way, but I’m not comfortable wit treating something that changes as though it doesn’t change. I think it could lead to broken/unexpected behavior. The reason this is okay with
style
is that it only changes shallowly but that would not be the case with the indices you’re describing.I think we’re going in a circles a little at this point. 😄 If you’d like to create a PR for me to consider, I will make time to look at it. (Can’t promise it will be merged, but I will look at it.)
My goal: I need to give special behaviour to the first and last rendered cells vertical and horizontal. The way i can tell that a cell is first/last is comparing
item.rowIndex === item.itemsRenderedCallbackParams.overscanRowStartIndex
The idea is: even tho cell X,Y is changing, rowIndex === overscanRowStartIndex, I give it a named key,
first-in-column:first-in-row
,first-in-column:1-in-row
etc. That’s only if its a “special” cell. And that’s how react uses the same DOM element even that the X,Y is different.Let’s say i don’t have
overscanRowStartIndex
data as props, i can play with the key to force re-mount my edges cells by adding also x and y to the named key, something like:first-in-column-4:first-in-row-5
. it will be less performant for me, but i think its reasonable.Please see my itemKeyProvider: https://github.com/Bnaya/sticky-eurovision/blob/master/src/implementations/WithReactWindowAndSticky/WithReactWindowAndSticky.tsx#L50-L86 itemKey I hope it will be more clear
Aside of that, i still think its possible to implement areEqual is way that ignores
overscan...Index
values and treats them as never changed, but the developer can opt-in to it. Something like: