You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Pro 1.8.1 / iOS] pruneUnmountedEntries walks the shadow tree for every registered node on every mount, so UI-thread cost grows with the number of mounted styled nodes #717
UniwindMountHook::shadowTreeDidMount calls UniwindStore::pruneUnmountedEntries after every mount. That function calls family->getAncestors(rootShadowNode) for every registered entry. getAncestors follows parent pointers up to the root, then scans siblings linearly at each level on the way back down. It also allocates two vectors per call.
Reanimated (and any other UI-thread-driven update) triggers a mount every frame. So each animation frame costs O(registered nodes × tree depth × siblings) on the main thread, no matter which nodes changed.
In practice, almost every className registers. Tailwind 4 spacing, font weights and colours are all CSS variables, so even flex-row items-center gap-1 registers with the Variables dependency. Nodes in screens that are mounted but not visible also count, such as inactive tabs, which React Navigation keeps mounted.
In our app, a FlatList of about 70 rows (10 registered nodes per row) on a background tab took the registry from 152 to 924 entries. After that, every drag on the visible tab dropped below 60 fps on an iPhone 14 Pro Max: the bottom sheet, scroll shadow and press feedback all run Reanimated animations. Restyling only the rows with StyleSheet brought it down to 77 entries and fixed the stutter.
Suggestion: prune only for families removed in the mount transaction, or track liveness without walking the tree from the root per entry. For example, check against the mutation list, or use a set of mounted families updated incrementally.
Steps to Reproduce
Mount a FlatList of about 70 rows. Each row has several className views and texts using spacing, font or colour classes.
Leave it mounted, for example on another tab, and run any Reanimated animation on the visible screen (a drag, a sheet).
Watch UI-thread FPS in the Perf Monitor on a physical device. Frame drops scale with the number of mounted rows.
Activity