Nested Navigators Re-render the whole tree #11290
-
Hi! I really tried to search on google & this repo's issues or discussions but without success. I'm posting in Discussion because I know that my problem is an intended behavior but I wanted to know what can be done about this. So I have a deeply-nested navigator architecture with a Drawer, BottomTabs & a Stack inside, of course. Here's how much time it takes to switch tab on the ios emulator which should be able to maintain under 16ms with blank screens, but it bearly does: It seems that re-rendering the tree is way too much. Am I missing something? Is there a reason for the absence of memoization or layering so that only modified navigators switching screens would re-render. I really want to have a smooth navigation experience and right now I really don't see what to do to go further. I don't really wanna migrate to RNN as I need a lot of customization. Thank you for reading, appreciate you taking that time! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The navigation state is stored at the root so memoization can't avoid re-rendering the whole tree. What can be avoided is re-rendering of any individual expensive components. If you can identify any specific components that are expensive to re-render then PRs are welcome. Whether you have an empty view or not shouldn't matter because your screens don't re-render on navigation. You're also measuring in development mode which is less performant. |
Beta Was this translation helpful? Give feedback.
The navigation state is stored at the root so memoization can't avoid re-rendering the whole tree. What can be avoided is re-rendering of any individual expensive components. If you can identify any specific components that are expensive to re-render then PRs are welcome.
Whether you have an empty view or not shouldn't matter because your screens don't re-render on navigation. You're also measuring in development mode which is less performant.