Repository navigation
fix(core): support stickyHeaderTemplate as an XML element template - #11722
Merged
NathanWalker merged 1 commit intoDec 2, 2026
Merged
Conversation
Register `stickyHeaderTemplate` in `Builder.knownTemplates` so the `<ListView.stickyHeaderTemplate>` element form is compiled into a template function. Also adds a sectioned ListView example to apps/ui and automated tests covering the XML element form and function templates binding section data. Closes NativeScript#11697
Contributor
|
✅ All contributors on this pull request have satisfied the NativeScript CLA. |
Contributor
Author
|
I have read the CLA and I hereby sign the CLA |
Contributor
|
Thanks @liuy97 — your signature on this PR satisfies the CLA check, and you'll be recorded on the |
NathanWalker
approved these changes
Dec 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
I have read the CLA and I hereby sign the CLA).What is the current behavior?
When
stickyHeaderTemplateis declared using the XML element form:the builder does not treat
stickyHeaderTemplateas a template, so the header content is not compiled into a template function. On Android, only string templates were handled, so headers fell back to a defaultSection Nlabel. Header creation was also implemented separately on iOS and Android, with different parsing and fallback behavior.What is the new behavior?
stickyHeaderTemplateis registered inBuilder.knownTemplates, so<ListView.stickyHeaderTemplate>compiles into a template function, just likeitemTemplate.ListViewBase._resolveStickyHeaderView(section). It accepts both string and function templates and is used on both iOS and Android. If the template is missing or fails, the header falls back to aSection Nlabel. This replaces the duplicated per-platform parse/fallback code and removes the unused iOS_headerTemplateCache.sectioned-listviewexample page toapps/ui.apps/automated:test_stickyHeaderTemplate_xml_element_form_is_a_templatetest_stickyHeader_function_template_binds_sectionCloses #11697.