fix(Reanimated): preserve layout updates during entering animations - #10382
fix(Reanimated): preserve layout updates during entering animations#10382ngocdevv wants to merge 7 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughUpdated legacy and experimental layout animation proxies to refresh ongoing animation targets from current Merge Risk: 🟡 Moderate · up to The experimental layout-animation proxy can abort debug builds when deleting animated nodes and leak node entries in release builds because its deletion assertion conflicts with the animation lifecycle. This concrete runtime issue should be fixed before merging. 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation The implementation addresses issue Full details: Out of Scope Changes checkExplanation The proxy changes are in scope for Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
|
CodeRabbit chat interactions are restricted to organization members for this repository. Ask an organization member to interact with CodeRabbit, or set |
…ion-layout-updates # Conflicts: # packages/react-native-reanimated/CHANGELOG.md
…ion-layout-updates # Conflicts: # packages/react-native-reanimated/CHANGELOG.md
…ion-layout-updates # Conflicts: # packages/react-native-reanimated/CHANGELOG.md
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/react-native-reanimated/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp (1)
271-281: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winAccept
DELETEDin theDeletecase and erase the stalelightNodes_entry.Bruce found the real smoking gun here.
startAnimationsRecursivelymarks removed descendants asDELETEDand emitsRemovefollowed byDelete, but it does not erase theirlightNodes_entries. The currentDeletecase rejectsDELETEDin debug builds and retains the entry in release builds.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ffafc504-55ea-4d9b-83ee-cb94732fe60a
📒 Files selected for processing (3)
packages/react-native-reanimated/CHANGELOG.mdpackages/react-native-reanimated/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpppackages/react-native-reanimated/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/react-native-reanimated/CHANGELOG.md
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.
|
Regarding the CodeRabbit outside-diff warning: the flagged Delete logic comes from upstream #10392 and is not part of this PR's final diff. React Native emits descendant Delete mutations before the removed subtree's root Remove, as described in #10392, so each entry is erased while its state is still UNDEFINED. startAnimationsRecursively later walks retained child shared pointers and may mark a now-detached node DELETED; there is no later original Delete for that node. The final diff against main remains limited to the five files for #10161, and the merged experimental proxy passed the arm64 Android C++ build. |
…ion-layout-updates # Conflicts: # packages/react-native-reanimated/CHANGELOG.md
|
Thank you for this PR and the clear repro. Indeed the bug is confirmed, and your fix seems to have been addressing it well. Note that these days we are working on some refactors of the layout animations proxy and the current rework in this matter addresses the issue as well (that refactor also caused all the conflicts that appeared in your PR afterwards). To be more specific #10373 is something we wish to land in the next release and its work includes the fix for the new refactored structure of the proxy as well. I will therefore close this in favor of #10373 that supersedes this PR. Nevertheless, big thanks for your will of contribution. Cheers! |
Note
This pull request was authored by AI on behalf of @ngocdevv.
Summary
Fixes #10161.
React updates that do not have a configured layout transition are passed directly to the mounting layer. When such an update happens during an entering animation, the animation proxy kept the original
finalView. The next animation frame was then based on that stale snapshot and reapplied the old layout metrics, leaving the native hit-testing bounds smaller than the visible content.This change keeps the ongoing animation target synchronized with pass-through React updates in both the legacy and experimental Layout Animations proxies. The experimental proxy uses the LightNode's merged current view so Android diffed props are preserved as well.
Test plan
Manual regression test using the reproduction from https://github.com/mozzius/layout-animation-grow-repro:
EmptyExample.SlideInRight.USE_ANIMATION_BACKENDdisabled and enabled.Validated on a Pixel 9 Pro Android API 36 emulator with both Layout Animations backends. In each case, a tap in the previously stale lower region incremented the counter from 0 to 1.
Checks run:
yarn build-packagesyarn workspace react-native-reanimated format:common --dry-run -Werroryarn workspace react-native-reanimated lint:appleyarn workspace react-native-reanimated lint:jsyarn workspace react-native-reanimated type:check:src:nativeyarn workspace react-native-reanimated test --runInBand(1,556 tests)./gradlew :app:assembleDebug -PreactNativeArchitectures=arm64-v8a --no-daemonwith both Layout Animations backendsChangelog
Unpublishedsection of each changed package'sCHANGELOG.md, or this PR does not changereact-native-reanimatedorreact-native-worklets.