0

There are documentation and examples of navigating from tab view to other single views. But I can't find any information about navigating from a single view to a tab view.

Is there a possibility to this.props.navigator.push to view with tabs somehow? If not is there are some workarounds to achieve that?

Roo
  • 613
  • 1
  • 7
  • 24

2 Answers2

0

You should do something like this:

Your main stack navigator:

import HomeScreenTabs from '../yourpath/TabNavigator';

const MainStack = createStackNavigator({
  HomeScreen: {
    screen: HomeScreenTabs,
  },
  SingleViewScreen1: {
    screen: SomeSingleViewScreen,
    navigationOptions: {...}
  },
  SingleViewScreen2: {
    screen: SomeOtherSingleViewScreen,
    navigationOptions: {...}
  },
}

Your tab navigator:

//Your 3 tab screens
import Home from '../Home';
import Profile from '../Profile ';
import Feedback from '../Feedback ';

const Tabs = createBottomTabNavigator(
  {
    Home: {
      screen: Home 
    },
    Profile: {
      screen: Profile 
    },
    Feedback: {
      screen: Feedback
    }
  },

export default Tabs;

And in order to navigate to the Tabs screen from e.g. SingleViewScreen1 you would do this.props.navigation.navigate('HomeScreen').

iuliu.net
  • 6,666
  • 6
  • 46
  • 69
  • I'm using a Wix React Native Navigation. – Roo Aug 25 '18 at 08:44
  • Oh. Apologies. Confused with `react-navigation` :D (btw if you want to give it a try I strongly recommend it, it's really powerful) – iuliu.net Aug 25 '18 at 08:50
  • I think I'll have to because I can't do such a simple thing with a Wix navigation. – Roo Aug 25 '18 at 09:05
  • You'll thank yourself in the future. [react-navigation](https://reactnavigation.org/) is the way to go. And is also the preffered navigation system chosen by Expo, so you know it's good. :D – iuliu.net Aug 25 '18 at 09:11
  • @iuliu.net [react-navigation](https://reactnavigation.org/) is **NOT** a native navigation system like [Wix navigation](https://wix.github.io/react-native-navigation/v2). There is a big performance step-up when using a native navigation system like [Wix](https://wix.github.io/react-native-navigation/v2). Native navigation runs on UI thread unlike [react-navigation](https://reactnavigation.org/) which runs on JS thread. It really has everything [react-navigation](https://reactnavigation.org/) has, it just has a slightly different API. – Christos Lytras Aug 30 '18 at 22:36
  • Oh, that's interesting, just did some research and you seem to be right. Never used wix's navigation system but I thought it's built the same way as react-navigation. Thanks for the heads up. – iuliu.net Aug 31 '18 at 10:53
0

Use a Wix Navigation v2. It's pretty stable even it says that it is an alpha release. It solves this issue.

Roo
  • 613
  • 1
  • 7
  • 24