Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReactNavigation: How do avoid screen re-rendering when not visible

I notice the all the screens are being re-rendered as I navigate through the app even though they are not active(visible). The only exception are the screens in TabNavigator with LazyLoad set to true. If yes, how do I suppress the rendering i and trigger the render only when visible

like image 833
mzafer Avatar asked Apr 18 '17 11:04

mzafer


1 Answers

You should use shouldComponentUpdate to check data from redux to decide if you need re-rendering your component. It uses the same api in react. You can check here: https://facebook.github.io/react/docs/react-component.html#shouldcomponentupdate

like image 123
Tyreal Gray Avatar answered Sep 22 '22 08:09

Tyreal Gray