triniwiz / nativescript-accordion

Apache License 2.0
38 stars 14 forks source link

Calling js method onGroupExpand Faile #71

Open mmerbes opened 5 years ago

mmerbes commented 5 years ago
 An uncaught Exception occurred on "main" thread.
com.tns.NativeScriptException: 
Calling js method onGroupExpand failed
TypeError: Cannot read property 'slice' of undefined
File: "file:///data/data/com.g2planet.eventmobile.desmoinesauto/files/app/vendor.js, line: 100395, column: 55
StackTrace: 
    Frame: function:'onGroupExpand', file:'file:///data/data/com.g2planet.eventmobile.desmoinesauto/files/app/vendor.js', line: 100395, column: 56
    at com.tns.Runtime.callJSMethodNative(Native Method)
    at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1203)
    at com.tns.Runtime.callJSMethodImpl(Runtime.java:1083)
    at com.tns.Runtime.callJSMethod(Runtime.java:1070)
    at com.tns.Runtime.callJSMethod(Runtime.java:1050)
    at com.tns.Runtime.callJSMethod(Runtime.java:1042)
    at com.tns.gen.android.widget.ExpandableListView_OnGroupExpandListener.onGroupExpand(ExpandableListView_OnGroupExpandListener.java:19)
    at android.widget.ExpandableListView.handleItemClick(ExpandableListView.java:707)
    at android.widget.ExpandableListView.performItemClick(ExpandableListView.java:662)
    at android.widget.AbsListView$PerformClick.run(AbsListView.java:3190)
    at android.widget.AbsListView$3.run(AbsListView.java:4108)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7319)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:934)
An uncaught Exception occurred on "main" thread.
com.tns.NativeScriptException: 
Calling js method onGroupExpand failed

TypeError: Cannot read property 'slice' of undefined
File: "file:///data/data/com.g2planet.eventmobile.desmoinesauto/files/app/vendor.js, line: 100395, column: 55

StackTrace: 
    Frame: function:'onGroupExpand', file:'file:///data/data/com.g2planet.eventmobile.desmoinesauto/files/app/vendor.js', line: 100395, column: 56
    at com.tns.Runtime.callJSMethodNative(Native Method)
    at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1203)
    at com.tns.Runtime.callJSMethodImpl(Runtime.java:1083)
    at com.tns.Runtime.callJSMethod(Runtime.java:1070)
    at com.tns.Runtime.callJSMethod(Runtime.java:1050)
    at com.tns.Runtime.callJSMethod(Runtime.java:1042)
    at com.tns.gen.android.widget.ExpandableListView_OnGroupExpandListener.onGroupExpand(ExpandableListView_OnGroupExpandListener.java:19)
    at android.widget.ExpandableListView.handleItemClick(ExpandableListView.java:707)
    at android.widget.ExpandableListView.performItemClick(ExpandableListView.java:662)
    at android.widget.AbsListView$PerformClick.run(AbsListView.java:3190)
    at android.widget.AbsListView$3.run(AbsListView.java:4108)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7319)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:934)

HTML Template ` <Accordion height="100%" [items]="items" allowMultiple="false" [selectedIndexes]="selectedIndexes">

                <ng-template let-i="index" let-item="item" acTemplateKey="header">
                    <StackLayout>
                        <Label backgroundColor="green" [text]="item.headerText"></Label>
                    </StackLayout>
                </ng-template>

                <ng-template let-i="index" let-item="item" acTemplateKey="title">
                    <GridLayout backgroundColor="white">
                        <Label height="100%" [text]="item.title"></Label>
                    </GridLayout>
                </ng-template>

                <ng-template let-i="index" let-item="item" acTemplateKey="content">
                    <StackLayout>
                        <Image width="300" height="300" decodeWidth="400" decodeHeight="400" [src]="item.image"></Image>
                        <Label [text]="item.text"></Label>
                    </StackLayout>
                </ng-template>

                <ng-template let-i="index" let-item="item" acTemplateKey="footer">
                    <StackLayout>
                        <Label backgroundColor="yellow" [text]="item.footerText"></Label>
                    </StackLayout>
                </ng-template>
            </Accordion>`

Item Code

this.items = [
      {
        title: '1', footer: '10', headerText: 'First', footerText: '4',
        items: [
          { image: '~/images/a9ff17db85f8136619feb0d5a200c0e4.png', text: 'Stop' },
          { text: 'Drop', image: 'http://static.srcdn.com/wp-content/uploads/Superman-fighting-Goku.jpg' }
        ]
      }

When ever I click to expand on an according the app crashes and I get the error above. Accordion is imported into the module. Angular - 8.0.6 typescript - 3.4.5 "nativescript-accordion": "^6.0.0-beta.2"

My best guess is that it has something to do with including the module on the Page tag however I am just learning Angular/NativeScript and no app I've built has required the use of the page tag and no place that I've added it has fixed the issue.