Repository navigation
feat: report CSS transition events from the engine - #10119
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughCSS transitions now track platform-routed properties and cancellation through ChangesCSS transition lifecycle
Estimated code review effort: 4 (Complex) | ~45 minutes Mergeability Score: ⚪ Minimal · up to The change adds CSS transition event reporting without any supplied evidence of an actionable current-head merge risk; it is merge-ready after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant Caller
participant ReanimatedModuleProxy
participant CSSTransitionsRegistry
participant CSSTransition
participant CSSEventsEmitter
Caller->>ReanimatedModuleProxy: runCSSTransition(..., eventMask)
ReanimatedModuleProxy->>CSSTransitionsRegistry: setEventMask
ReanimatedModuleProxy->>CSSTransition: updateConfigOrRun
CSSTransition->>CSSTransitionsRegistry: onTransitionEvent
CSSTransitionsRegistry->>CSSEventsEmitter: emit CSS event
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
64bf2e8 to
f7097a0
Compare
f7097a0 to
17a3976
Compare
17a3976 to
9636aef
Compare
8656f8e to
6e36da2
Compare
0e1eb39 to
7b8b275
Compare
6e36da2 to
fcae3bc
Compare
7b8b275 to
22003a1
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/react-native-reanimated/Common/cpp/reanimated/CSS/core/transition/CSSTransition.cpp`:
- Around line 49-90: Update CSSTransition::trackPlatformLifecycles so each
removed platform-routed property is aborted before being removed from
loopTransition_, using a property-scoped CSSLoopTransition operation rather than
the all-properties abort. Preserve removal for unrelated properties, and add
coverage for removing an active platform-routed property when TransitionCancel
is enabled.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 3afcc0e9-dc45-4aa9-9b0c-41afcdb8928e
📒 Files selected for processing (14)
packages/react-native-reanimated/Common/cpp/reanimated/CSS/core/transition/CSSLoopTransition.cpppackages/react-native-reanimated/Common/cpp/reanimated/CSS/core/transition/CSSLoopTransition.hpackages/react-native-reanimated/Common/cpp/reanimated/CSS/core/transition/CSSTransition.cpppackages/react-native-reanimated/Common/cpp/reanimated/CSS/core/transition/CSSTransition.hpackages/react-native-reanimated/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.cpppackages/react-native-reanimated/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.hpackages/react-native-reanimated/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpppackages/react-native-reanimated/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.hpackages/react-native-reanimated/src/ReanimatedModule/NativeReanimated.tspackages/react-native-reanimated/src/ReanimatedModule/js-reanimated/JSReanimated.tspackages/react-native-reanimated/src/ReanimatedModule/reanimatedModuleProxy.tspackages/react-native-reanimated/src/css/native/managers/CSSTransitionsManager.tspackages/react-native-reanimated/src/css/native/managers/__tests__/CSSTransitionsManager.test.tspackages/react-native-reanimated/src/css/native/proxy.ts
0b83466 to
c15a8d7
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/react-native-reanimated/Common/cpp/reanimated/CSS/core/transition/CSSLoopTransition.h`:
- Around line 60-63: Update CSSLoopTransition::removeProperties and related
removal paths to abort each active property with RunMilestone::Aborted before
removing its provider, exposing a property-scoped abort-and-remove API in
CSSLoopTransition.h. Use this scoped operation for discrete-property handling
and dynamic diffs in CSSLoopTransition.cpp, and for removed platform or evicted
properties in CSSTransition.cpp; do not call CSSLoopTransition::abort, which
cancels unrelated properties. Add regression coverage verifying TransitionCancel
for active property removal. Affected sites:
packages/react-native-reanimated/Common/cpp/reanimated/CSS/core/transition/CSSLoopTransition.h
lines 60-63 (add API); CSSLoopTransition.cpp lines 112 and 144 (use it), lines
166-174 (abort before removal); CSSTransition.cpp lines 73-75 and 140-142 (use
it).
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 0d2cacbf-26ab-4ba8-aed4-edb2c3c8aec0
📒 Files selected for processing (5)
packages/react-native-reanimated/Common/cpp/reanimated/CSS/core/transition/CSSLoopTransition.cpppackages/react-native-reanimated/Common/cpp/reanimated/CSS/core/transition/CSSLoopTransition.hpackages/react-native-reanimated/Common/cpp/reanimated/CSS/core/transition/CSSTransition.cpppackages/react-native-reanimated/Common/cpp/reanimated/CSS/core/transition/CSSTransition.hpackages/react-native-reanimated/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.cpp
fe67b48 to
364f1cd
Compare
c15a8d7 to
6ab43fc
Compare
364f1cd to
0799825
Compare
6ab43fc to
bec2b76
Compare
0799825 to
2768e15
Compare
bec2b76 to
50d3234
Compare
2768e15 to
4bfe7be
Compare
50d3234 to
e2ff0a2
Compare
4bfe7be to
4152615
Compare
e2ff0a2 to
8b356d3
Compare
b827c72 to
4535ccd
Compare
32e0611 to
5e204de
Compare
4535ccd to
2b55e26
Compare
5e204de to
f70e04b
Compare
2b55e26 to
eb1671c
Compare
f70e04b to
116d8e1
Compare
eb1671c to
4dcac97
Compare
116d8e1 to
a215235
Compare
4dcac97 to
a6b31d3
Compare
a215235 to
0ef68d8
Compare
0ef68d8 to
8d1a4a2
Compare
Makes `onTransitionRun`, `onTransitionStart`, `onTransitionEnd` and `onTransitionCancel` fire on iOS and Android. They already work on web, and the shared types promised them everywhere, but native dropped them. The per-view callbacks manager now holds one callback store per CSS kind. Each store names its own prop table, keeps its own mask, builds its own payload shape and narrows the event type with its own predicate, so an event is routed by exactly one lookup and neither kind can read the other table. Only the masks cross the JSI boundary, never the user functions, and the transition mask is diffed so an unchanged set of callbacks costs no native call. Callbacks are passed inside `style`, alongside the other CSS config props. Stacked on #10119.
CSSTransition::trackPlatformLifecycles (#10119) registers a progress provider for a platform-routed property purely to report its lifecycle events, and never creates an interpolator for it. interpolate() indexed the interpolator map with an unchecked at() for every provider, so a routed transition with a callback prop attached aborted the app with std::out_of_range. Mark those providers as platform-driven and skip them when interpolating; any other provider without an interpolator still asserts in dev, so a genuine desync between the two collections is not silently swallowed.
Emits CSS transition events from the engine and delivers them through the shared CSS events channel: transitionrun, transitionstart, transitionend and transitioncancel.
Properties whose rendering is routed to a platform transition temporarily track their lifecycle on the loop clock, so their events fire from common code until the platform can report its own. The subscription mask travels as a separate runCSSTransition argument rather than inside the config, where every key is read as a CSS property name. The mask is always empty for now because transition callbacks do not reach the transitions manager yet.