rightNavButton dissapears

You must Login before you can answer or comment on any questions.

I have added a button to my window via rightNavButton, the window is a child of a tabGroup. When returning to the window after visiting another tab the button disappears. Subsequent windows with this button added in the same manner behave as expected.

Any ideas?

— asked 2 years ago by Rob Marston
1 Comment
  • I've run into this same issue and so have a number of other users. If you find anything out please let me know as I've yet to find a fix. My question was asked here: https://developer.appcelerator.com/question/119120/persistant-rightnavbutton-disappears-from-nav-when-you-go-back-to-previous-page

    — commented 2 years ago by Chris Hoopes

3 Answers

Accepted Answer

So I find a solution:

win.addEventListener('focus', function (e) {
        var t = e.source.rightNavButton;
        e.source.rightNavButton =null;
        e.source.rightNavButton=t;
 
    });
This restores the rightNavButton every time the windows gets focused. Works with a barImage and a label as titleControl. Tested with Titanium SDK 1.8.2.

I think I figured this out. It took a long time and a lot of headache but what I've discovered is that you can't use both a custom rightNavBar and window.barImage at the same time. I have no idea why and it might be a bug but when you go back in the navigation hierarchy the rightNavButton drops behind the barImage. Remove that and you should be golden!

Also just to clarify, I'm adding the rightNavButton to every page via a global header instead of passing it through to each window when it's declared. And I tried creating and adding the rightNavButton after setting the barImage but to no avail, you simply can't have both at once for some reason.

Your Answer

Think you can help? Login to answer this question!