Components nested deeper than certain level are invisible on some iOS versions

Recently I had a problem in my React Native app where certain elements of the UI were invisible on iOS 12.4. It turned out that these were the components that were nested too deeply inside the view hierarchy - more than around 85 components deep. I know that's a lot, it was caused by the usage of the React Navigation library and our design of the screen hierarchy. Someone had a similar problem here.

Turns out that the component nesting limit varies by iOS version. On 12.4 it was around 85, while on 14.1 it seems to be over 140, which is why we had no issues when developing for the newer versions. Interestingly enough, on 12.0 the components seem to always appear, until the view hierarchy depth crashes the app, which seems to happen around 350 levels. I made a GitHub repo to reproduce the issue here. It displays 300 nested UIStackViews with a UILabel in every tenth of them displaying the current nesting level. You can see how it displays on those iOS versions I mentioned:

iOS 12.4
iOS 14.1
iOS 12.0

It seems to be a very obscure issue - for the vast majority of apps, 85 levels of component nesting is more than enough, hence why I haven't been able to find almost anything about this issue on the internet. However, I hope that maybe here somebody, probably an Apple engineer, will tell me if there's a way to influence the limit of component nesting on various versions of iOS. This has caused our team some headaches in recent days due to issues on production.
That maybe a question to ask to React Native as well.

It may well be that they have a limit in some table to the depth of nesting (85 seems already huge, why do you need so much ?)
It's not a limit in React Native, it's an iOS limit. I made a sample app that doesn't use React Native and the limit is still visible.

I know 85 is huge, but a combination of using a navigation library that uses lots of views and a badly engineered navigation system caused that issue.
Well, maybe they have introduced a smaller limit to the depth levels.

Ask question to Apple support, or burn a DTS ticket ; but better solution may be to reengineer your app (anyway, you risk tough maintenance issues in the future with the present design).

Good luck.

PS: Depending on Apple Support answer, you could file a bug report, at least against documentation.
Components nested deeper than certain level are invisible on some iOS versions
 
 
Q