We have been using react-navigation 4 for 2 years and had a nice experience with it. We decided to update to v5 recently and since then we are experiencing a few issues.
We started diving into this because our automated UI tests started failing when Appium was not able to find the components on the iOS application.
Appium limits the number of nested views to 50 when processing the view tree. There are already issues opened in their repo but I would also like to get more into why is this happening after the migration.
I've used the debug view hierarchy feature from Xcode to try to understand what is the actual view tree of the app. This is a slice of all the views that are in the hierarchy when running the application You can see the difference in the following screenshots:
This is already a fair amount of views but this is how this looks in RN5:

The number of views has been increased by 30 approx.
The performance has also been impacted. There are slight delays between the user triggers the action and the navigation happens. Not sure if that is directly related to the fact that more views are on the stack now.
The delay is unnoticeable in release mode.
I was wondering if anyone would be aware of a way to reduce the number of child views that appeared after the transition from react-navigation 4 to 5.
