Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1609] Cannot see RightNavButtons with TabGroup inside NavigationWindow

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionInvalid
Resolution Date2015-12-08T09:15:10.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy
Labelsn/a
ReporterKristen Bachman
AssigneeMostafizur Rahman
Created2015-11-04T16:15:56.000+0000
Updated2016-03-08T07:38:05.000+0000

Description

When using a _TabGroup_ within a _NavigationWindow_, the _RightNavButtons_ of any _Window_ within the _TabGroup_ do not appear in the navigation bar. I've included example code of the issue below. Upon clicking the "Open Window" button on the main view, the _TabGroup_ opens and the *< Back* option appears in the navigation bar, but the _RightNavButtons_ do not appear. I've found that If I remove the _NavigationWindow_ and use a standard _Window_ element in index.xml (and update index.js to use view.open() instead of $.nav.openWindow(view)), then the _RightNavButtons_ will be visible for the _Window_ in that _TabGroup_. I'm using an alloy project that has 2 views; *index* and *tabs*. All of the relevant code to reproduce the issue is as follows: *index.xml*
<Alloy>
    <NavigationWindow id="nav">
        <Window backgroundColor="#fff">
            <Button onClick="open">Open Window</Button>
        </Window>
    </NavigationWindow> 
</Alloy>
*index.js*
$.nav.open(); 
function open()
{
    var view = Alloy.createController("tabs").getView();
    $.nav.openWindow(view); 
}
*tabs.xml*
<Alloy>
    <TabGroup>
            <Tab title="one">
                <Window backgroundColor="#fff">
                    <Label>Hello 1</Label>
                    <RightNavButtons>
                        <Button title="push"></Button>
                        <Button title="push2"></Button>
                    </RightNavButtons>
                </Window>
            </Tab>
            <Tab title="two">
                <Window backgroundColor="#fff">
                    <Label>Hello 2</Label>
                </Window>
            </Tab>
    </TabGroup>
</Alloy>

Comments

  1. Aminul Islam 2015-11-05

    Hi , Thanks for your concern. TabGroups create their own controller when you open windows ON the tab. But when you use $.nav.openWindow(view) , NavigationWindow hide the TabGroup's *RightNavButtons* . This is not a bug. Thanks
  2. Kristen Bachman 2015-11-05

    Hi Aminul, Thanks for responding so quickly. I've done a considerable amount of API digging and trial and error, and it seems that I do not have control over the visibility of the _RightNavButtons_ when they are in a _TabGroup_ that is opened by a _NavigationWindow_. _RightNavButtons_ will only appear if the _NavigationWindow_ directly opens a _Window_. For example, if I change *tabs.xml* (from above) to the example below, then the _RightNavButtons_ are visible. New *tabs.xml*:
       <Window backgroundColor="#fff">
       	<RightNavButtons id="rightButtons">
       		<Button title="push"></Button>
       		<Button title="push2"></Button>
       	</RightNavButtons>
       	<Label>Hello 1</Label>
       </Window>
       
    In addition, according to the API documentation, neither _Tab_ nor _TabGroup_ objects support the use of _RightNavButtons_ as they do not inherit from Titanium.UI.Window. Although _NavigationWindow_ has a rightNavButtons property, setting that property does not make the _rightNavButtons_ visible. In other words, in index.js, adding the following code has no effect on the navigation bar; no "test" button appears:
    $.nav.setRightNavButtons(Ti.UI.createButton({title:"test"}));
    To summarize, it seems that _RightNavButtons_ will only appear when a _NavigationWindow_ directly opens a _Window_ that has those _RightNavButtons_. However, _RightNavButtons_ will NOT appear when a _NavigationWindow_ opens a _TabGroup_ containing _Windows_ that have _RightNavButtons_. Is it possible to make the _RightNavButtons_ visible in the latter scenario? If so, how?
  3. Sharif AbuDarda 2015-11-24

    Hello [~bachmakm], The reason you can't see the RightNavButtons is your navigation bar is opening under the tab bar. Why do you need the navigation bar? Each Tab already has a Navigation Controller, so adding a NavigationWindow is simply wrong. Please follow this community post and try on Malcolm Hollingsworth's answer about [tackling navigation window in tab group alloy](https://developer.appcelerator.com/question/175579/tackle-navigation-window-in-tab-group-alloy)
  4. Kristen Bachman 2015-11-30

    Hi Sharif, I looked at link that you had posted in your comment above and that scenario is slightly different than mine. In the community post, the user is trying to open a NavigationWindow within a TabGroup, whereas in my case, I am trying to open a TabGroup within a NavigationWindow. The proposed solution in the community solution is to save a reference to the Tab in the TabGroup and open any new Window objects within that referenced Tab. Unfortunately, this is not a viable solution for me. In my case, I do not see 2 navigation bars; I see one navigation bar, and I understand that the TabGroup navbar may be hidden underneath the NavigationWindow navbar, but I want to manipulate what appears in the RightNavButtons section of the visible navigation bar. Is there not a way to do this?

JSON Source