Skip to content

Conversation

@NathanWalker
Copy link
Contributor

@NathanWalker NathanWalker commented Sep 2, 2025

What is the current behavior?

It's possible to hook up custom delegate methods to handle sticky headers and auto-hiding search input but there were no declarative options to enable these features in stock ListView.

What is the new behavior?

ListView support for sticky headers, sectioned data, and a built-in search bar, along with tests and a demo page to showcase it.

ns-listview-sticky-headers.mp4
<ListView 
  stickyHeader="true" 
  sectioned="true"
  stickyHeaderTopPadding="false" 
  stickyHeaderHeight="45"
  stickyHeaderTemplate="<GridLayout><Label text='{{ title }}' fontSize='18' fontWeight='bold' color='#009bff' padding='8 0 8 12' borderBottomWidth='1' borderBottomColor='#ccc' borderTopWidth='1' borderTopColor='#ccc' backgroundColor='#fff' /></GridLayout>"  
  showSearch="true" 
  searchAutoHide="true" 
  searchChange={ onSearchTextChange } />

Various flavors can wire up to ease of use options on stickyHeaderTemplate usage.

Sectioned data may be used with the following format (items can take on any shape desired):

const countries: { title: string; items: { name: string; }[] }[] = [
  {
    title: 'A',
    items: [
      {
        name: 'Antarctica',
        code: '(AQ)',
        flag: '🇦🇶',
      },			
    ],
  },
]

ListView Feature Additions

  • Added new properties to ListView for sticky headers (stickyHeader, stickyHeaderTemplate, stickyHeaderHeight, stickyHeaderTopPadding), sectioned lists (sectioned), and a built-in search bar (showSearch, searchAutoHide [ios only]).

Search Event Support

  • Added a new searchChange event and its corresponding SearchEventData type, allowing consumers to react to search input changes in ListView.

Testing and Demo Improvements

  • Added tests for both iOS and Android in list-view-tests.ts, verifying section rendering, header binding, explicit header height, and correct header updates.
  • Created a new demo page (list-page-sticky.xml and list-page-sticky.ts) to showcase the new sticky header and sectioned list features shown above.

@NathanWalker NathanWalker added this to the 9.0 milestone Sep 2, 2025
@nx-cloud
Copy link

nx-cloud bot commented Sep 2, 2025

View your CI Pipeline Execution ↗ for commit 49c361c

Command Status Duration Result
nx test apps-automated -c=android ✅ Succeeded 4m 49s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-05 23:23:59 UTC

@NathanWalker NathanWalker changed the title Feat/list view sticky headers feat(ListView): sticky headers, sectioned data, built-in search bar with auto-hide option Sep 2, 2025
@NathanWalker NathanWalker changed the title feat(ListView): sticky headers, sectioned data, built-in search bar with auto-hide option feat(ListView): sticky headers, sectioned data, optional search bar with auto-hide option Sep 2, 2025
@NathanWalker NathanWalker changed the title feat(ListView): sticky headers, sectioned data, optional search bar with auto-hide option feat(ListView): sticky headers, sectioned data, optional search bar with auto-hide Sep 2, 2025
Base automatically changed from refactor/circular-deps to main September 19, 2025 00:03
@NathanWalker NathanWalker added the docs needed Additional documentation on this issue/PR is needed label Sep 27, 2025
@NathanWalker NathanWalker requested a review from Copilot October 29, 2025 17:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds sticky header and search functionality to the NativeScript ListView component. The implementation provides sectioned list support with sticky headers that remain visible while scrolling, and integrated search capabilities for both iOS and Android platforms.

  • Adds sticky header support with customizable templates and heights for sectioned lists
  • Implements native search functionality with UISearchController on iOS and SearchView on Android
  • Introduces new properties: stickyHeader, stickyHeaderTemplate, stickyHeaderHeight, stickyHeaderTopPadding, sectioned, showSearch, searchAutoHide

Reviewed Changes

Copilot reviewed 11 out of 15 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/webpack5/src/configuration/base.ts Fixed string quote consistency (double to single quotes)
packages/webpack5/package-lock.json Changed devOptional to dev for numerous dependencies
packages/core/ui/list-view/list-view-common.ts Added core properties and methods for sticky headers, sectioned data, and search functionality
packages/core/ui/list-view/index.ios.ts Implemented iOS-specific sticky headers using UITableView sections and UISearchController
packages/core/ui/list-view/index.d.ts Added TypeScript definitions for new ListView features and SearchEventData interface
packages/core/ui/list-view/index.android.ts Implemented Android sticky headers with overlay positioning and native SearchView
packages/core/ui/index.ts Exported SearchEventData type
packages/core/package.json Bumped version to 9.0.0-alpha.13
package-lock.json Changed nativescript dependency from "*" to "alpha"
apps/toolbox/src/pages/* Added demo pages showcasing sticky header and search functionality
apps/automated/src/ui/list-view/list-view-tests.ts Added tests for sticky header functionality on iOS and Android
Files not reviewed (1)
  • packages/webpack5/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

packages/core/ui/list-view/index.ios.ts:1

  • The magic number 50 appears twice with identical comments. Extract this as a named constant (e.g., DEFAULT_SEARCH_VIEW_HEIGHT = 50) and reuse it to eliminate duplication.
import { ItemEventData, SearchEventData, ItemsSource } from '.';

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@NathanWalker NathanWalker merged commit f8e15fd into main Nov 5, 2025
4 of 6 checks passed
@NathanWalker NathanWalker deleted the feat/list-view-sticky-headers branch November 5, 2025 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs needed Additional documentation on this issue/PR is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants