Hrutvik Patel
Hrutvik Patel

Reputation: 621

How can you implement a react navigator for child components wrapped by a parent screen?

So I have a Home screen that has a gif animation in the background and is a parent of child components that get swapped in and out on actions taken (for example a button click that swaps child component to enter room code and then swaps that component for another that allows the user to enter name and etc). Is there a way to set up a react navigator for those child components?

Right now I have it using a handleChangeView function that I pass down to those child components in props that allows them to move back and forth between child component swaps.

I would appreciate any suggests for best practices for doing something like this or on how I can use the react navigator for this situation.

Upvotes: 1

Views: 41

Answers (1)

Romain Lavalle
Romain Lavalle

Reputation: 129

Navigators handle well screens, but i dont think adding them to a navigator will help as the only other info you will be able to display on the parent screen is the header.

You can pass this.props.navigation as a props to your childs if you want to do some navigation actions regarding the rest of your app from there, but i dont think you need to add them to a navigator as they are not 'screens' themselfs.

Upvotes: 1

Related Questions