-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: prevent material tabBarItem from re-rendering when using material-top-tabs #11385
Conversation
✅ Deploy Preview for react-navigation-example ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #11385 +/- ##
==========================================
+ Coverage 75.43% 75.45% +0.02%
==========================================
Files 189 189
Lines 5712 5717 +5
Branches 2254 2253 -1
==========================================
+ Hits 4309 4314 +5
Misses 1353 1353
Partials 50 50
☔ View full report in Codecov by Sentry. |
The Expo app for the example from this branch is ready! |
6137405
to
d5b3e41
Compare
d5b3e41
to
fc53d5f
Compare
When is this going to be published? Is urgent, as material-top-tabs are laggy when you touch the tabs. |
Unfortunately, this PR can't be merged as-is because the additional memoization breaks some stuff with rendering. I'm going to work today on some performance boosts for material-top-tabs however, there will be RFC with breaking API changes proposed to make this faster and released as a new major version of tab-view. |
Closing this PR all issues with |
Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro. |
Motivation
This issue addresses performance problems when using material-top-tabs and having many tabs. The problem was with passed callbacks which were causing all TabBarItems to re-render on index change. It should address this issue: #11047
Before:
![CleanShot 2023-05-26 at 12 12 12@2x](https://private-user-images.githubusercontent.com/52801365/241192436-1d30f4f5-7a01-48ca-a115-51f3cd4ea9e3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIzNDQ1OTAsIm5iZiI6MTcyMjM0NDI5MCwicGF0aCI6Ii81MjgwMTM2NS8yNDExOTI0MzYtMWQzMGY0ZjUtN2EwMS00OGNhLWExMTUtNTFmM2NkNGVhOWUzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzMwVDEyNTgxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE1YjUzYzIwMjFiYmMyOWE3YTJkOWQ3ZDgzNjM4ZTIwYjg0MGFkMDMxOTM0ZDhlNjE4ZGU1MzNkMDE5ZGU0MzAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.a-hcNafzzh-2c0SReG--jkcrdpC3pDfupkf7ZSa3xsI)
After:
![CleanShot 2023-05-26 at 12 10 47@2x](https://private-user-images.githubusercontent.com/52801365/241192464-440ceb78-3c1d-45aa-bb10-f051b1b06a66.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIzNDQ1OTAsIm5iZiI6MTcyMjM0NDI5MCwicGF0aCI6Ii81MjgwMTM2NS8yNDExOTI0NjQtNDQwY2ViNzgtM2MxZC00NWFhLWJiMTAtZjA1MWIxYjA2YTY2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzMwVDEyNTgxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTk1OGJmYzQxN2JiOGE2OTE4ZTNmYjg3MWNjNGZiYjEwNzYzNzk4MmFiNjE1OWRhN2FlOWZiOTY4M2RjODE2ZTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Hr1xEOdfVq6wxxYtxF7kGUTXDhNrydqI-ViUgVuSDR8)
Test plan
Launch Material Top Tabs example and check that only necessary tab items are re-rendering.