viezel / NappDrawer

A side drawer navigation container view controller for Appcelerator Titanium.
MIT License
248 stars 128 forks source link

Child windows orientations #215

Closed JoseBLuna closed 6 years ago

JoseBLuna commented 6 years ago

Please, I need help. In my app, the new window called from leftWindowDrawer should allow the user to rotate, but the drawer (main window) not. However, when I set the orientationModes property of drawer to Ti.UI.PORTRAIT, every new window called from drawer using navigation window have same behavior. If I set the new window orientationModes to Ti.UI.PORTRAIT, Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT, there is no effect. Anyone know how solve this? I made a simple code based from Nappdrawer example on git. Thanks in advance. Here is ...

// // Sample code based on NappDrawer example // var NappDrawerModule = require('dk.napp.drawer');

function createAPIExampleWindow() { var win = Ti.UI.createWindow();

var data = [{title: 'New Window'}];

var tableView = Ti.UI.createTableView({ data: data });

tableView.addEventListener('click', function(e) { switch (e.index) { case 0: openNewNavWindow(); break; } });

win.add(tableView); return win; }

function openNewNavWindow() { // // In my app, the new window should allow the user to rotate // var win = Ti.UI.createWindow({ backgroundColor: '#222', translucent: true, extendEdges: [Ti.UI.EXTEND_EDGE_TOP], title: 'New Window', barColor: '#FFA', tintColor: 'yellow', orientationModes: [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT, Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT] });

var textLabel = Ti.UI.createLabel({ color: 'white', left: '20%', right: '20%', align: 'center', textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT, text: 'My text here \n\nBla Bla Bla Bla Bla Bla Bla Bla Bla \nBla Bla Bla Bla Bla Bla Bla Bla Bla Bla \nBla Bla Bla Bla Bla Bla Bla Bla Bla ' });

win.add(textLabel);

mainWindow.openWindow(win, {animated:true}); drawer.toggleLeftWindow(); }

function createCenterNavWindow() { var leftBtn = Ti.UI.createButton({ title: 'Left' }); leftBtn.addEventListener('click', function() { drawer.toggleLeftWindow(); }); var rightBtn = Ti.UI.createButton({ title: 'Right' }); rightBtn.addEventListener('click', function() { drawer.toggleRightWindow(); });

var win = Ti.UI.createWindow({ backgroundColor: '#eee', translucent: false, title: 'NappDrawer', barColor: '#ca2127', tintColor: '#ca2127', navTintColor: '#fff', titleAttributes: {color: '#fff'}, leftNavButton: leftBtn, rightNavButton: rightBtn });

var navController = Ti.UI.iOS.createNavigationWindow({ window: win }); return navController; }

var mainWindow = createCenterNavWindow();

var drawer = NappDrawerModule.createDrawer({ leftWindow: createAPIExampleWindow(), centerWindow: mainWindow, rightWindow: Ti.UI.createWindow({backgroundColor: '#FFF'}), closeDrawerGestureMode: NappDrawerModule.CLOSE_MODE_ALL, openDrawerGestureMode: NappDrawerModule.OPEN_MODE_ALL, showShadow: false, //no shadow in iOS7 leftDrawerWidth: 200, rightDrawerWidth: 120, statusBarStyle: NappDrawerModule.STATUSBAR_WHITE, // remember to set UIViewControllerBasedStatusBarAppearance to false in tiapp.xml orientationModes: [Ti.UI.PORTRAIT] });

drawer.open();

JoseBLuna commented 6 years ago

Anyone can help me? I made several attempts, but none worked. It looks like Nappdrawer is a "super container" and everything below it runs on the same orienation mode. I haven't to do more. Thanks

guiled commented 6 years ago

Hi, I haven't any solution for you right now, but I can advise you to try the widget https://github.com/jasonkneen/nl.fokkezb.drawer/ which is very easy to use. Try to set orientaionModes to the Window ?

JoseBLuna commented 6 years ago

Many thanks, guiled. I don't use Alloy, but I appreciate your concern. Any window bellow drawer have the same orientationMode drawer setted on the drawer, even though I change the orientation of the child window.

hansemannn commented 6 years ago

This should be fixed in ios-2.1.1, thx!

JoseBLuna commented 6 years ago

Great!!!! Many thanks.

JoseBLuna commented 6 years ago

Please, when version 2.1.1 will be available on giiTio?

kbshl commented 6 years ago

The list view (when you search „nappdrawer“) on gittio shows iOS v 2.1.1. badge already. Have you tried fetching it with gittio cli?

Otherwise you can grab it from the releases page on the Github repo:

https://github.com/viezel/NappDrawer/releases

or diectly from here:

https://github.com/viezel/NappDrawer/releases/download/ios-2.1.1/dk.napp.drawer-iphone-2.1.1.zip

JoseBLuna commented 6 years ago

Many thanks! Work perfectly. Great job!