Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20488] Docs: Ti.UI.Window.onBack is Android/Mobile-Web only

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-12-28T14:41:12.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsios, onback, window
Reporteremanuele de cupis
AssigneeHans Knöchel
Created2016-02-25T12:09:30.000+0000
Updated2018-08-06T17:57:47.000+0000

Description

The Window.onBack property seems not to work on iOS. I attach a simple alloy project in which I demonstrate the issue. If you look at the _new_window_ controller, you can find _$.win.onBack = onBack;_ (_onBack_ to be a function). However, _onBack_ isn't raised on back. I also tried by assigning the property to the navigation window instead, but with no results.

Attachments

FileDateSize
issue.onback.zip2016-02-25T12:09:18.000+00008918132

Comments

  1. Chee Kiat Ng 2016-03-01

    [~sdarda] Can you try using classic? I'm curious if the issue is that the callback has to be defined during creation. for e.g.:
       var win3 = Ti.UI.createWindow({
           onBack: function() {...}
       }
       
  2. Hans Knöchel 2016-09-14

    There is no "onBack" event on both iOS and Android. However, Android has [androidback](http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Window-event-androidback) which is a platform-specific event. In addition, the event-listeners need to be in the XML and referenced in the JS. Just for the future.
  3. emanuele de cupis 2016-09-16

    What about this: [http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Window-property-onBack]
  4. Hans Knöchel 2016-09-16

    Hey [~balanza], never noticed that property, sorry. Reopening the ticket, we will take a look!
  5. Hans Knöchel 2016-09-16

    Ok so here is what happens: The property was never used for iOS or Mobileweb, it is Android-only. The property was undocumented for a long time and was documented last june. But because the platforms: [android] key was missing in the docs, the generator thought it would be available on all platforms. And since the fact that the property is only for the (physical hardware) button on Android-devices, it doesn't make sense on other platforms. See [here](https://github.com/appcelerator/titanium_mobile/commit/b14b37b9ae8dceb378c4a423ac8478baa3656a21#diff-235b09746f8440f0b12241286a59b2faR598) for the related commit. If you want to execute actions after click the back (software) button, you can do that using the close event of a Ti.UI.Window. PR to adjust the docs: https://github.com/appcelerator/titanium_mobile/pull/8387
  6. (deactived) Brian Immel 2016-09-16

    [~hans123], the yaml file change looks good but the Jenkins build has failed. Will merge once we have a successful build.
  7. Eric Merriman 2018-08-06

    Cleaning up older fixed tickets from 2016 and earlier. If this ticket should not have been closed, please reopen it.

JSON Source