Ignite: Tab Nav in Ignite 2: on the right track?

Created on 8 Apr 2017  路  2Comments  路  Source: infinitered/ignite

I'm a RN newb building a tab-navigated app in Ignite2 (with the "next" boilerplate that adds React Navigation).

I got it working by editing AppNavigation.js and replacing the StackNavigator it exports by a TabNavigator. That seems to work OK so far, but it breaks ignite generate screen because it can no longer add the new screen to the stack nav. When now I try to create a new screen, I get (unsurprisingly):

Error: 'import { StackNavigator } from' was not found in file /Users/pekka/..../Appname/App/Navigation/AppNavigation.js.

Was my approach incorrect? Should a Stack Navigation always be an app's "root" nav, and I need to tack on the tab nav on a level below?

Or is it just the generator that hasn't been built to be aware of different types of "root" navigation yet and I should leave things as they are? The generator still works, the error message isn't a showstopper and you just add the route manually.

I'm looking to write up a blog post on how to do this for people like me, and I want to recommend the right way here.

help wanted question

Most helpful comment

@pekkanikolaus in my approach, the stack navigation is indeed always an app's "root".

I simply add the tabs inside stackNavigator. I don't know if this will solve your problem with the generator though.
you can check out a working sample here: https://github.com/HarrisRobin/ignite-react-navigation-redux-example

All 2 comments

@pekkanikolaus in my approach, the stack navigation is indeed always an app's "root".

I simply add the tabs inside stackNavigator. I don't know if this will solve your problem with the generator though.
you can check out a working sample here: https://github.com/HarrisRobin/ignite-react-navigation-redux-example

I simply add the tabs inside stackNavigator. I don't know if this will solve your problem with the generator though.

I think it should. I'll check out your example. Many thanks!

Was this page helpful?
0 / 5 - 0 ratings