I'm trying to make a complex app where there are 5 pages (Bottom Tab Navigator) and multiple screens (Native Stack Navigator). The multiple screens are supposed to open in the 5 pages. I wish to use the same screen names in the 5 pages and multiple screens for consistency purposes and I have the requirement of having cycles of these screens being opened. I'm getting lots of warnings regarding cycling nested screens and screens with the same names such as:
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
Screens with same name warning:
Found screens with the same name nested inside one another. Check:
Home -> PROVIDER_PAGE -> PRODUCT_PAGE -> PROVIDER_PAGE -> PRODUCT_PAGE
This can cause confusing behavior during navigation. Consider using unique names for each screen instead.
How can I achieve this in the clean way and ignore these warnings?
Sample Project Link
You can have your Tab and Stack navigators structure like this to achieve your requirement,
I have added this change in Home Tab Navigator of your snack, you may check it here.
Mainly I have removed the Stack Navigator from each Product and Provider screen, and
added a title parameter in navigation.push .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With