Android performance regression: view flattening is broken (0.71) #37797
Labels
Impact: Regression
Describes a behavior that used to work on a prior release, but stopped working recently.
Issue: Author Provided Repro
This issue can be reproduced in Snack or an attached project.
Needs: Triage 🔍
Platform: Android
Android applications.
Description
After updating from React Native 0.67 to 0.71 (still using the old architecture), we noticed our view hierarchy has grown significantly.
While debugging the issue, we noticed there now seems to be a 1:1 relations ship between React components and actual views on the screen.
The issue started happening after the introduction of accessibilityValue (e8739e9) and accessibilityState (98d84e5).
Both objects (even if empty) are passed into all components, and, as a result, seem to be skipped while flattening the hierarchy.
On the positive side, this issue seems to be (accidentally?) fixed in 0.72 already: 3681df2. Instead of always passing the accessibility value object, it's now only passed in if one of the values is actually present.
For the time being, we managed to restore view flattening by applying the following patch:
React Native Version
0.71.10
Output of
npx react-native info
Steps to reproduce
Here's a Snack containing a reproduction project: https://snack.expo.dev/@lctwisk/flattening-repro-project
In this project, we've added an example component, taken from the view flattening docs.
We've used the Android layout inspector to retrieve the view hierarchy.
First without the fix:
view_hierarchy_without_fix.txt
And after, with the fix applied:
view_hierarchy_with_fix.txt
Even for a tiny component, there's a clear difference in the size of the view hierarchy.
Snack, code example, screenshot, or link to a repository
https://snack.expo.dev/@lctwisk/flattening-repro-project
The text was updated successfully, but these errors were encountered: