gethuman / nativescript-sidedrawer

SideDrawer menu plugin for Nativescript - iOS/Android
Other
41 stars 10 forks source link

Error: No animation target specified #17

Open xhe opened 7 years ago

xhe commented 7 years ago

Hi, I followed exactly the same as the documentation mentioned and when I try to toggle the TnsSideDrawer, I am getting this error:

CONSOLE ERROR [native code]: ERROR Error: No animation target specified. CONSOLE ERROR [native code]: ERROR CONTEXT [object Object]

Can anyone tell me what is this error?

sychus commented 6 years ago

try this:

showSideDrawer() {
        TnsSideDrawer.build({
            templates: [{
                title: 'example',
                androidIcon: '',
                iosIcon: '',
            }, {
                title: 'Change password,
                androidIcon: '',
                iosIcon: '',
            }, {
                title: 'Close session',
                androidIcon: '',
                iosIcon: '',
            }],
            title: 'Title example',
            subtitle: 'My example',
            listener: (index) => {
                switch (index) {
                    case 0: {
                        this.myAccount();
                        break
                    };
                    case 1: {
                        this.myPassword();
                        break;
                    };
                    case 2: {
                        this.closeSession();
                        break;
                    }
                }
            },
           context: this,
        });
        bTnsSideDrawer.toggle(true, 200);
    }

Pay attention that the called functions aren't in this example!