ProgressNS / nativescript-ui-feedback

This repository is used for customer feedback regarding Telerik UI for NativeScript. The issues system here is used by customers who want to submit their feature requests or vote for existing ones.
Other
115 stars 21 forks source link

RadListView `groupingFunction` crashes iOS app #1524

Closed SingleMalted closed 3 years ago

SingleMalted commented 3 years ago

Tell us about the problem

App crashes when RadListView groupingFunction is set on iOS.

Which platform(s) does your issue occur on?

iOS device & simulator - any OS version

Please provide the following version numbers that your issue occurs with:

NS+TS CLI: 8.0.1 NS Core: 8.0.1 iOS Runtime: 8.0.0 nativescript-ui-listview: 9.1.0

Please tell us how to recreate the issue in as much detail as possible.

  1. Create a NS8+TS app
  2. Add a RadListView
  3. Set RLV groupingFunction in either the UI or Code-behind

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

const rlv = this.page.getViewById("RLV") as RadListView;
rlv.groupingFunction = this.myGroupingFunc;
<lv:RadListView id="RLV" items="{{ stores }}" itemTap="{{onItemTap}}" groupingFunction="{{ myGroupingFunc }}">

iOS Crash Log

CONSOLE ERROR: Binding: Binding error while setting property items of RadListView<RLV>@main-page.xml:27:9;: Error: -[TKDataSourceGroupDescriptor copyWithZone:]: unrecognized selector sent to instance 0x600002b52680
***** Fatal JavaScript exception - application has been terminated. *****
NativeScript encountered a fatal error: Uncaught Error: -[TKDataSourceGroupDescriptor copyWithZone:]: unrecognized selector sent to instance 0x600002b1f9c0
at
TKListViewDataSourceImpl.initDataOperationsSource(file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/nativescript-ui-listview/ui-listview.ios.js:554:0)
at TKListViewDataSourceImpl.initWithOwner(file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/nativescript-ui-listview/ui-listview.ios.js:528:0)
at reloadDataSource(file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/nativescript-ui-listview/ui-listview.ios.js:873:0)
at refresh(file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/nativescript-ui-listview/ui-listview.ios.js:1548:0)
at updateHeaderFooter(file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/nativescript-ui-listview/ui-listview.ios.js:1005:0)
at bindingContextChanged(file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/nativescript-ui-listview/ui-listview.ios.js:968:0)
at _handleEvent(file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/@nativescript/core/data/observable/index.js:230:0)
at notify(file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/@nativescript/core/data/observable/index.js:216:0)
at Property.set(file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/@nativescript/core/ui/core/properties/index.js:196:0)
at (file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/@nativescript/core/ui/core/properties/index.js:416:0)
at (file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/@nativescript/core/ui/core/properties/index.js:430:0)
at eachChildView(file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/@nativescript/core/ui/layouts/layout-base-common.js:101:0)
at eachChild(file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/@nativescript/core/ui/core/view/view-common.js:759:0)
at (file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/@nativescript/core/ui/core/properties/index.js:421:0)
at (file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/@nativescript/core/ui/core/properties/index.js:430:0)
at eachChildView(file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/@nativescript/core/ui/content-view/index.js:65:0)
at eachChildView(file: app/webpack:/@nativescript/template-hello-world-ts/node_modules/@nativescript/core/ui/page/page-common.js:106:0)
at<…>

Ref: https://github.com/ProgressNS/nativescript-ui-feedback/issues/1374#issuecomment-820512224

SingleMalted commented 3 years ago

I was able to fix my issue with the groupingFunction for iOS. It's seems that the groupingFunction has to return a string.

    get myGroupingFunc(): (item: any) => any {
        return (item: DataItem) => {
            // return item.category
            return item.category === 1 ? "First Group" : "Second Group";
        };
    }