There are several things that do not seem OK with this component:
-> Where do we get back the options.data passes as second parameter of the pushPage method?
-> there should be all core ons-navigator component methods available on Navigator like: insertPage(index, page, [options]), removePage(index, [options]), resetToPage(page, [options]), bringPageTop(item, [options])…
@Songkeys not after but it is indeed part of the DOM rendering. You can do what @Fran-Diox suggested or if you really want to use that hook you can wait for page init, when everything is already set up:
I usually wonder whether I can use <List> without dataSource/renderRow, but specifying <ListItem> manually. It works but I’m not sure if it is legal (e.g. may not work in future versions) because it’s not mentioned in this tutorial. Then I found the pattern in the tutorial. So I guess it is legal.
@ephraimt@munsterlander I am not sure that this demo actually works the way it is described. The initial active tab is being set correctly through index. However, if you setState in the prechange to always be index 0 you can still swap between the tabs.
In my application I can get the tabbar to be a “controlled” component, it always selects the tab you click. This looks like it is happening on the internal onClick method of ons-tabbar that is overriding the setActiveTab method in the React component.