Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18183] iOS: Add property to disable "swipe to go back" gesture on navigation controller windows.

GitHub Issuen/a
TypeImprovement
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2015-10-28T22:20:47.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
LabelsTCSupportTriage, ios, navigationWindow, tabgroup, window
ReporterEd
AssigneeHans Knöchel
Created2014-08-16T00:40:48.000+0000
Updated2017-03-22T22:38:37.000+0000

Description

With iOS 7, Apple introduced a new navigation gesture where you can swipe to the right from the left edge of the device to close a sub window within a navigation controller (NavigationWindow, TabGroup). This feature is enabled by default. Currently, there is no way to disable this on Titanium except for a [workaround of using a custom leftNavButton](https://developer.appcelerator.com/question/158264/how-to-disable-back-swipe-gesture-on-ios-7). While this works, it is not ideal for all situations, and a property to toggle this feature would be better. There's a solution posted on stackoverflow that could potentially be used to expose a new property on the Ti Window control: [http://stackoverflow.com/questions/17209468/how-to-disable-back-swipe-gesture-in-uinavigationcontroller-on-ios-7] In our particular case, we need to disable this gesture on some windows that have ScrollableViews within, as it can interfere with swiping for those views.

Comments

  1. Sebastian Klaus 2015-03-17

    +1
  2. kosso 2015-05-28

    Interestingly, this behaviour has just broken when using Appcelerator Studio. See this post in Q&A : [Swipe right from the edge to go back to the previous window doesn't work anymore in iOS (Using SDK 3.5.1.GA and 4.0.0.GA)](https://community.appcelerator.com/topic/581/swipe-right-from-the-edge-to-go-back-to-the-previous-window-doesn-t-work-anymore-in-ios-using-sdk-3-5-1-ga-and-4-0-0-ga/3) Test code works on all 3+ SDKs using Titanium Studio. Don't does not work when using Appc. Studio.
  3. Marian Kucharcik 2015-09-25

    Is there any news about this? It would be nice to have ability to disable swipe-to-back gesture for specific window. Thank you
  4. kosso 2015-09-25

    Using a custom backButton on the window will disable it.
  5. Marian Kucharcik 2015-09-25

    Yes, I know, but it will be good to have this funcionality, if you want to use system back button.
  6. Hans Knöchel 2015-10-28

    We introduce the new property swipeToClose in the Ti.UI.Window API to enable and disable the swipe-to-close gesture inside a Ti.UI.iOS.NavigationWindow and Ti.UI.Tab. This property is true by default. PR: https://github.com/appcelerator/titanium_mobile/pull/7368
  7. Pedro Enrique 2015-10-28

    Merged:
       var nav = Ti.UI.iOS.createNavigationWindow({});
       
       var win = Ti.UI.createWindow({
       	backgroundColor: 'white',
       	title: 'Swipe to close test'
       });
       
       nav.window = win;
       
       var btn1 = Ti.UI.createButton({
       	title: 'swipe enabled',
       	top: 50
       });
       var btn2 = Ti.UI.createButton({
       	title: 'swipe not enabled',
       	top: 150
       });
       
       btn1.addEventListener('click', function(){
       	nav.openWindow(Ti.UI.createWindow({
       		backgroundColor: '#ccc',
       		title: 'swipe to close'
       	}));
       });
       
       btn2.addEventListener('click', function(){
       	nav.openWindow(Ti.UI.createWindow({
       		backgroundColor: '#ccc',
       		title: 'cannot swipe to close',
       		swipeToClose: false
       	}));
       });
       win.add(btn1);
       win.add(btn2);
       nav.open();
       
  8. Lee Morris 2017-03-22

    Closing ticket as fixed.

JSON Source