SideDrawer not working on version 4.x


#1

Hi,
Does anybody has any ideas, why this plugin is not working after update from 3.5->4.0?
I cant find any breaking changes.
Maybe, i don’t have some dependencies ?
I have no idea.

My simple javascript that worked prevoiusly is:

var frame = require('ui/frame');
require("nativescript-dom");
var LS = require("nativescript-localstorage");

exports.toggleDrawer = function () {

    var menu = frame.topmost().getViewById("openMenu");
    var

drawer = frame.topmost().getViewById(“sideDrawer”);

if (menu.classList.contains('hidden')) {
    drawer.closeDrawer();
} else {
    drawer.showDrawer();
}

};

Thanks for any help.


#2

Can you please be more specific what exactly is not working, I can confirm SideDrawer works in my apps running in 4.x


#3

Hi @manojdcoder,
The error is :
file:///app/tns_modules/nativescript-ui-sidedrawer/ui-sidedrawer.js:228:29: JS ERROR TypeError: undefined is not an object (evaluating ‘this.mainContent.layout’)


#4

Were you able to reproduce the issue in Playground?


#5

I’ve never use this, maybe it’s time to start.
But just to be sure, i don’t import anything (require) regarding sidedrawer.
On 3.5.1 all is ok, but upgrading to 4.x makes this issue.
Downgrading works well…


#6

Sorry, without seeing an example where the issue could be reproduced I’m unable to give any directions.

But I’m sure it works with 4.x, you may even checkout the drawer starter template.


#7

Can yo share a like for this ? Thank you !


#8

I followed this guide to get my side drawer working.

You can also try deleting the platforms folder in the root to force a complete rebuild.