sanjeevyadavIT / magento_react_native

🛒 MageCart: E-commerce app for Magento 2.x written in React Native
GNU General Public License v3.0
282 stars 124 forks source link

Navigation drawer rerendering multiple times, without any state change #1

Closed sanjeevyadavIT closed 5 years ago

sanjeevyadavIT commented 5 years ago

Describe the bug The DrawerPage component is rendering multiple times, even when state is not changing. This in turns forces child component DrawerHeader and CategoryTree component to render multiple times, which is not good for performance

Expected behavior The DrawerPage should have rendered only 3 times, i.e.,

  1. When component is mounted for the first time
  2. When status changes from DEFAULT to LOADING
  3. Finally when status changes from LOADING to SUCCESS/FAILURE

Current Behavior The DrawerPage is rendering multiple times, without any state change. check the log message ALERT: Inside Navigation Drawer render function

Steps to Reproduce Please provide detailed steps for reproducing the issue.

  1. Open the app in debugging mode
  2. See the log message in console in web browser
  3. Wait or open any other page, the DrawerPage wiill render multiple times.

Screenshots Screenshot from 2019-06-02 09-46-56

Smartphone (please complete the following information):

Additional context Help needed!

sanjeevyadavIT commented 5 years ago

TODO

  1. [ ] New react-navigation@next has new set of API to create navigation, replace old 4.x react-navigation API with new one
  2. [x] Lock Drawer Navigator by specifying Lock Mode at screen other than HomePage.