React-native-navigation: [V2] looks like initialTabIndex is missing

Created on 10 Jun 2018  路  8Comments  路  Source: wix/react-native-navigation

Issue #2902 has been closed.
But i could not find initialTabIndex or equivalent in the docs.
I even checked the source code about parsing bottom tab options and i could not find it there either.
It's kind of necessary especially (in my case) if we consider the current RTL support situation.
In RTL mode the most right tab is considered the first tab.
Ideally RNN should recognize RTL and responds by reversing the tabs order and setting the most right tab as the default tab automatically.
Currently RNN does not do that.
Although it would be really great for an option to reverse or change the order of tabs but at least it's possible using some simple code.
But i can't find any way to change the default tab to any tab except the most left tab.
is there something I'm missing here?
is there some kind of a solution for V2 that I'm not aware of?

Any kind of help would be welcome.


Environment

  • React Native Navigation version: 2.0.2329
Android iOS v2

Most helpful comment

same as @rishabhpoddar issue, currentTabIndex not working in IOS when using it in setRoot

RN 0.57.5
RNN 2.1.3

All 8 comments

You can set Initial tab index by passing bottomTabs.currentTabIndex options:

Navigation.setRoot({
  root: {
    bottomTabs: {
      children: [
        {
          component: {
            name: 'navigation.playground.TextScreen'
          }
        },
        {
          component: {
            name: 'navigation.playground.TextScreen'
          }
        }
      ],
      options: {
        bottomTabs: {
          currentTabIndex: 1
        }
      }
    }
  }
});

@yogevbd Please reopen this issue since currentTabIndex locks the bottom tabs to the tab you set it too and you can't switch to another tab anymore. No feasible solution from my understanding.

Setting currentTabIndex breaks the app differently depending on platform. On iOS it causes glitches with tabs so every time I need to tap another tab twice to make the app show that tab. Also tab styles go crazy. On Android it seems to show another tab but goes back right away, so it looks like I always stay on initial tab no matter what I tap. Please fix this guys.

I am using RNN version 2.0.2577, and currentTabIndex does not seem to work for iOS when using it in the setRoot function. But it does work when using it with mergeOptions

I have the issue that @rishabhpoddar reported above, currentTabIndex was working for me some versions ago, It stops working after updating from "react-native-navigation": "^2.0.2428" to "react-native-navigation": "2.0.2580"

same as @rishabhpoddar issue, currentTabIndex not working in IOS when using it in setRoot

RN 0.57.5
RNN 2.1.3

Does not work with setRoot.

RN: 0.57.0
RNN: 2.1.2

Was this page helpful?
0 / 5 - 0 ratings