-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Description
I'm opening this issue for discussion at the moment, because I'm not quite sure what the proper fix is yet.
React Native's Navigator uses a pattern that will return, if the component has already been rendered before, a StaticContainer
element that has no children with the shouldUpdate
prop set to false. This never breaks "in real life", because the whole point of not updating that component is to keep the previous reconciliation. The problem is, when using something like React Hot Loader, it force updates all components in the tree...so it will fail with an onlyChild invariant violation in StaticContainer when this pattern is used.
Can we think of any elegant way to keep Navigator working with React Hot Loader? Theoretically, in the check in NavigatorNavigationBar and NavigatorBreadcrumbNavigationBar that is determining whether to recalculate the children or not, if we could know whether or not the component is being forceUpdated, we could allow for the recalculation of the children. I'm just honestly not sure how to check for that, or if that's some kind of anti-pattern.
/cc @ericvicenti