| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
When using a sectioned ListView with multiple item templates, the template
returned by _getItemTemplate could be wrong because it calls _getDataItem
which does not consider the sectioned data structure. This means the
itemTemplateSelector receives the section object (e.g. { title, items })
instead of the actual row data item, causing it to resolve the wrong template.
Fix by adding _getItemTemplateInSection(section, index) to ListViewBase that
uses _getDataItemInSection and _getItemsInSection to correctly resolve the
data item and its section's items array before passing them to the selector.
On iOS, tableViewCellForRowAtIndexPath, tableViewHeightForRowAtIndexPath, and
_prepareCell are updated to call _getItemTemplateInSection when sectioned is
enabled. The broken absoluteIndex workaround in _prepareCell is removed.
On Android, getItemViewType and _createItemView are updated to call
_getItemTemplateInSection when sectioned is enabled.
Fixes NativeScript#11133
|
View your CI Pipeline Execution ↗ for commit f39a385
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at 2026-08-14 22:10:40 UTC |
Sorry, something went wrong.
|
Thank you for this @VeinDevTtv! Did you confirm this with the toolbox as well? npm start > toolboxios ENTER ... or toolboxandroid - navigate to the demo page for list-page-sticky. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Checklist
What is the current behavior?
When using a sectioned ListView with multiple item templates and an itemTemplateSelector, the wrong template is returned for items. _getItemTemplate(index) calls _getDataItem(index) which reads directly from this.items[index]. In sectioned mode, this.items is an array of section objects (e.g. { title, items }), so indexing it by row number returns a section object instead of the actual row data item. The itemTemplateSelector then receives the wrong data and resolves the wrong template key, causing incorrect cell types to be recycled and rendered.
On iOS, _prepareCell contained a broken absoluteIndex workaround that summed up items across sections and fed that offset back into the same flat _getItemTemplate — which still hits this.items[absoluteIndex] on the sectioned top-level array, returning another section object.
What is the new behavior?
A new method _getItemTemplateInSection(section, index) is added to ListViewBase. It uses _getDataItemInSection to correctly fetch the row item from within its section, and _getItemsInSection to pass the section's own items array to the itemTemplateSelector — matching the same contract that _prepareItemInSection uses for binding contexts.
All call sites that select a template for a sectioned row are updated to use this method:
Fixes #11133.