mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 22:17:40 +08:00
feat(virtual-scroll): adds headerHeight and footerHeight (#18851)
Currently, if you have an ion-virtual-scroll with a list of items and a search bar for filtering them, when you change the list of items, the items disappear until rendered again, causing a flicker. This could be solved for the items using the itemHeight function to provide the exact height size and bypass some calculations and be more performant etc. However, if you had a header or footer, they would still flicker. This commit adds two more optional functions named headerHeight and footerHeight that return the exact size of the header and footer respectively and resolve the flicker.
This commit is contained in:

committed by
Manu MA

parent
c91819c94f
commit
00891119f7
18
core/src/components.d.ts
vendored
18
core/src/components.d.ts
vendored
@ -20,8 +20,10 @@ import {
|
||||
DatetimeChangeEventDetail,
|
||||
DatetimeOptions,
|
||||
DomRenderFn,
|
||||
FooterHeightFn,
|
||||
FrameworkDelegate,
|
||||
HeaderFn,
|
||||
HeaderHeightFn,
|
||||
InputChangeEventDetail,
|
||||
ItemHeightFn,
|
||||
ItemRenderFn,
|
||||
@ -2835,10 +2837,18 @@ export namespace Components {
|
||||
*/
|
||||
'footerFn'?: HeaderFn;
|
||||
/**
|
||||
* An optional function that maps each item footer within their height.
|
||||
*/
|
||||
'footerHeight'?: FooterHeightFn;
|
||||
/**
|
||||
* Section headers and the data used within its given template can be dynamically created by passing a function to `headerFn`. For example, a large list of contacts usually has dividers between each letter in the alphabet. App's can provide their own custom `headerFn` which is called with each record within the dataset. The logic within the header function can decide if the header template should be used, and what data to give to the header template. The function must return `null` if a header cell shouldn't be created.
|
||||
*/
|
||||
'headerFn'?: HeaderFn;
|
||||
/**
|
||||
* An optional function that maps each item header within their height.
|
||||
*/
|
||||
'headerHeight'?: HeaderHeightFn;
|
||||
/**
|
||||
* An optional function that maps each item within their height. When this function is provides, heavy optimizations and fast path can be taked by `ion-virtual-scroll` leading to massive performance improvements. This function allows to skip all DOM reads, which can be Doing so leads to massive performance
|
||||
*/
|
||||
'itemHeight'?: ItemHeightFn;
|
||||
@ -6101,10 +6111,18 @@ declare namespace LocalJSX {
|
||||
*/
|
||||
'footerFn'?: HeaderFn;
|
||||
/**
|
||||
* An optional function that maps each item footer within their height.
|
||||
*/
|
||||
'footerHeight'?: FooterHeightFn;
|
||||
/**
|
||||
* Section headers and the data used within its given template can be dynamically created by passing a function to `headerFn`. For example, a large list of contacts usually has dividers between each letter in the alphabet. App's can provide their own custom `headerFn` which is called with each record within the dataset. The logic within the header function can decide if the header template should be used, and what data to give to the header template. The function must return `null` if a header cell shouldn't be created.
|
||||
*/
|
||||
'headerFn'?: HeaderFn;
|
||||
/**
|
||||
* An optional function that maps each item header within their height.
|
||||
*/
|
||||
'headerHeight'?: HeaderHeightFn;
|
||||
/**
|
||||
* An optional function that maps each item within their height. When this function is provides, heavy optimizations and fast path can be taked by `ion-virtual-scroll` leading to massive performance improvements. This function allows to skip all DOM reads, which can be Doing so leads to massive performance
|
||||
*/
|
||||
'itemHeight'?: ItemHeightFn;
|
||||
|
Reference in New Issue
Block a user