many initial rerenders, All Tabs rerenders on switching tabs
Mohamed-kassim opened this issue · comments
Current behavior
we have 2 rerendering issues on the basic example:
-
on initial render, Main Tab Component renders twice, the on every tab all other tabs
-
on switching from one tab to another all other tab views rerenders, this happens on android and ios in snack it's not happening on the web
this is a reproducible example
Expected behavior
only 1 render on the initial mount, switching tabs doesn't cause full rerender
Reproduction
https://snack.expo.dev/eB4vmbYG8
Platform
- Android
- iOS
- Web
- Windows
- MacOS
Environment
package | version |
---|---|
react-native-tab-view | 3.1.1 |
react-native-pager-view | 5.4.15 |
react-native | 0.67.4 |
node | |
npm or yarn |
Couldn't find version numbers for the following packages in the issue:
react-native
expo
Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
react-native-pager-view
(found:5.4.9
, latest:5.4.15
)
Can you verify that the issue still exists after upgrading to the latest versions of these packages?
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
react-native
(found:0.67.4
, latest:0.68.1
)
Can you verify that the issue still exists after upgrading to the latest versions of these packages?
I can confirm this re-rendering issue.
Same issue for me too
But for now we prefer not to upgrade react-native
to the latest version
No chance to solve this with using react-native
0.67.4
?
@Mohamed-kassim you need to pass a function to second argument of memo that returns a boolean, in your snack example it will always re-render on changing the tabs.