[TIMOB-20488] Docs: Ti.UI.Window.onBack is Android/Mobile-Web only
GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-12-28T14:41:12.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | ios, onback, window |
Reporter | emanuele de cupis |
Assignee | Hans Knöchel |
Created | 2016-02-25T12:09:30.000+0000 |
Updated | 2018-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
[~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.:
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.What about this: [http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Window-property-onBack]
Hey [~balanza], never noticed that property, sorry. Reopening the ticket, we will take a look!
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 theclose
event of aTi.UI.Window
. PR to adjust the docs: https://github.com/appcelerator/titanium_mobile/pull/8387[~hans123], the yaml file change looks good but the Jenkins build has failed. Will merge once we have a successful build.
Cleaning up older fixed tickets from 2016 and earlier. If this ticket should not have been closed, please reopen it.