Please take a minute to read our NativeScript Code of Conduct before proceeding with posting issues or discussing. The purpose of this guide is to make communication and cooperation within our forums a pleasure for you and the other members.
Yes
ListView crushing on android after using onItemSelected
Android
After changing the RadListView to load on demand by changing the value of 'loadondemand = Auto' (in the html), we couldn't use 'onItemSelected()' any more because its crushing the app.
note that when 'loadondemand = None' everything is working fine.
the nativescript-ui-pro version is 3.2.0.
This is the error:

_(You can paste entire code snippets or attach a runnable project)_
also, on ios its working fine when 'loadondemand = Auto' and 'onItemSelected()' is used.
Thanks,
Tom
Hi, this is a configuration on which the exact error happens without using LoadOnDemand on android:
` "nativescript": {
"id": "XXX",
"tns-ios": {
"version": "3.3.0"
},
"tns-android": {
"version": "3.4.1"
}
},
"dependencies": {
"@angular/animations": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/platform-server": "^5.0.0",
"@angular/router": "^5.0.0",
"crypto-js": "^3.1.9-1",
"nativescript-angular": "^5.2.0",
"nativescript-background-http": "file:plugins/nativescript-background-http-3.1.0.tgz",
"nativescript-barcodescanner": "^2.6.1",
"nativescript-camera": "^3.1.2",
"nativescript-drop-down": "3.1.2",
"nativescript-exit": "^1.0.1",
"nativescript-floatingactionbutton": "^3.0.1",
"nativescript-geolocation": "^3.0.1",
"nativescript-google-maps-sdk": "^2.3.2",
"nativescript-gradient": "^2.0.1",
"nativescript-imagepicker": "^3.0.7",
"nativescript-loading-indicator": "^2.4.0",
"nativescript-ngx-fonticon": "^4.0.0",
"nativescript-ngx-slides": "^0.4.3",
"nativescript-platform-css": "^1.6.5",
"nativescript-pro-ui": "3.4.0",
"nativescript-theme-core": "~1.0.4",
"reflect-metadata": "~0.1.8",
"rxjs": "^5.5.2",
"tns-core-modules": "^3.4.0",
"zone.js": "~0.8.2"
},
"devDependencies": {
"babel-traverse": "6.4.5",
"babel-types": "6.4.5",
"babylon": "6.4.5",
"lazy": "1.0.11",
"nativescript-dev-typescript": "~0.5.0",
"typescript": "2.4.2"
}`
@tigrenok00 @tomshabtay I've tried to reproduce the issue using this demo application but to no avail.
Let me know if you have a sample project that can throw the error.
@NickIliev
We went back using 3.3.0 to solve that issue. However, now when we migrated to the separate plugins, the issue is happenning again (without using LoadOnDemand, simply onTap).
Please see this:
https://github.com/telerik/nativescript-ui-feedback/issues/530 (here it happens to someone else too)
I managed to recreate the issue.
its happening when the listview is in a modal-dialog.
the crush happening when you use the closeCallback() (ModalDialogParams) from onItemSelected().
i will provide a sample project soon.
I repreduced the issue in this project:
https://drive.google.com/open?id=1BI-kWmHZf5oaTPffKmIJHnfPHWgt8FVT (with node modules and platforms)
https://drive.google.com/open?id=17TeMGaq2jcrVxDokDTbM3DavxbMyoG92 (without node modules and platforms )
@NickIliev Hi, were you able to recreate the issue from Tom's project? We are waiting for a solution, thank you.
@tomshabtay thanks for the provided project - I was able to reproduce the crash when the RadListView is within a modal page. It seems that the issue is related to a timing problem with the closeCallback of the modal page.
I was able to overcome this one by introducing almost mocked delay to ensure that the close callback will be fired after the item selected logic is triggered.
For example (based on the project provided by @tomshabtay)
public onItemSelected(args: ListViewEventData) {
//this.dismissInput();
console.log("clicked");
let listview = args.object as RadListView;
setTimeout(() => {
this.params.closeCallback();
}, 1);
}
@tigrenok00 marking this as a bug and we will post any related info and updates in this issue.
Using the latest version nativescript-ui-listview 3.5.7 should fix the issue.
Most helpful comment
@tomshabtay thanks for the provided project - I was able to reproduce the crash when the RadListView is within a modal page. It seems that the issue is related to a timing problem with the closeCallback of the modal page.
I was able to overcome this one by introducing almost mocked delay to ensure that the close callback will be fired after the item selected logic is triggered.
For example (based on the project provided by @tomshabtay)
@tigrenok00 marking this as a bug and we will post any related info and updates in this issue.