Sectioned ListView may return wrong template
Issue Description
When using a sectioned ListView the template returned by _getItemTemplate may be wrong if multiple templates are used. _getItemTemplate calls _getDataItem which doesn't consider the structure of the data of a sectioned ListView. The method _getDataItemInSection is available to get the correct item.
The issue can be solved by adding a _getItemTemplateInSection method that calls _getDataItemInSection instead.
On iOS the methods tableViewCellForRowAtIndexPath, tableViewHeightForRowAtIndexPath and _prepareCell need to be updated to use _getItemTemplateInSection when a sectioned ListView is used.
On Android the methods getItemViewType and _createItemView need to be updated to use _getItemTemplateInSection.
Reproduction
No response
Relevant log output (if applicable)
Environment
OS: macOS 15.7.4 CPU: (10) arm64 Apple M1 Max Shell: /bin/zsh node: 22.20.0 npm: 10.9.3 nativescript: 9.0.3 # android java: 21.0.9 ndk: Not Found apis: 35 build_tools: 26.0.2, 27.0.1, 28.0.1, 28.0.3, 30.0.0, 30.0.3, 31.0.0, 32.0.0, 33.0.0, 33.0.1, 33.0.2, 34.0.0, 35.0.0, 35.0.1 system_images: - android-31 | Google APIs ARM 64 v8a - android-31 | Google Play ARM 64 v8a - android-35 | Google Play ARM 64 v8a - android-36 | Google Play ARM 64 v8a # ios xcode: 16.4/16F6 cocoapods: 1.16.2 python: 2.7.18 python3: 3.13.7 ruby: 3.3.9 platforms: - DriverKit 24.5 - iOS 18.5 - macOS 15.5 - tvOS 18.5 - visionOS 2.5 - watchOS 11.5
Dependencies
"dependencies": { "@klippa/nativescript-http": "^3.0.4", "@nativescript-community/ui-material-bottomsheet": "^7.2.77", "@nativescript/core": "~9.0.0", "@nativescript/firebase-core": "^5.0.2", "@nativescript/firebase-crashlytics": "^5.0.2", "@nativescript/firebase-messaging": "^5.0.2", "@nativescript/localize": "^5.2.0", "@nativescript/theme": "~3.0.2", "@nstudio/nativescript-barcodescanner": "^5.0.1", "nativescript-vue": "~3.0.0", "patch-package": "^8.0.1", "pinia": "^3.0.4", "sass": "1.70", "sharp": "^0.34.4", "url-parse": "^1.5.10" }, "devDependencies": { "@nativescript/android": "~9.0.0", "@nativescript/ios": "9.0.3", "@nativescript/tailwind": "^4.0.7", "@nativescript/types": "~9.0.0", "@nativescript/webpack": "^5.0.31", "@types/node": "^20.19.19", "@typescript-eslint/eslint-plugin": "^8.56.0", "@typescript-eslint/parser": "^8.56.0", "@vue/eslint-config-typescript": "^14.7.0", "eslint": "^10.0.0", "eslint-plugin-vue": "^10.8.0", "replace-in-file-webpack-plugin": "^1.0.6", "tailwindcss": "^4.1.18", "tsconfig-paths-webpack-plugin": "^4.2.0", "typescript": "~5.8.0" }
Note: some private dependencies have been omitted
Please accept these terms
- I have searched the existing issues as well as StackOverflow and this has not been posted before
- This is a bug report
- I agree to follow this project's Code of Conduct