You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my local fork of react list I wrote a helper method based on getVisibleRange. It is useful for me because I'm making a minimap of the whole list that needs to show exactly what is being shown in the list. This is contrived and fake data, but I think you can see the general idea:
The blue highlight layer is tracking the scroll percentage and to get the fraction of the scroll, I use getFractionalVisibleRange:
Here it is:
getFractionalVisibleRange(){const{ from, size }=this.state;const{ start, end }=this.getStartAndEnd(0);constcache={};letfirst,last;for(leti=from;i<from+size;++i){constitemStart=this.getSpaceBefore(i,cache);constitemEnd=itemStart+this.getSizeOf(i);if(first==null&&itemEnd>start)first=i+1-(itemEnd-start)/(itemEnd-itemStart);if(first!=null&&itemStart<end)last=i-(itemEnd-end)/(itemEnd-itemStart);}return[first,last];}
Anyways, I thought it might be useful to someone else or could maybe even be added to the library.
In my local fork of react list I wrote a helper method based on
getVisibleRange
. It is useful for me because I'm making a minimap of the whole list that needs to show exactly what is being shown in the list. This is contrived and fake data, but I think you can see the general idea:The blue highlight layer is tracking the scroll percentage and to get the fraction of the scroll, I use getFractionalVisibleRange:
Here it is:
Anyways, I thought it might be useful to someone else or could maybe even be added to the library.
@caseywebdev
The text was updated successfully, but these errors were encountered: