applyViewTransitionsOnFiber() — react Function Reference
Architecture documentation for the applyViewTransitionsOnFiber() function in ReactFiberApplyGesture.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 957c05d9_3d16_8881_1cdf_919ea0e11411["applyViewTransitionsOnFiber()"] 1018fb0f_66a4_cdd8_25b9_d3808a6cac4b["ReactFiberApplyGesture.js"] 957c05d9_3d16_8881_1cdf_919ea0e11411 -->|defined in| 1018fb0f_66a4_cdd8_25b9_d3808a6cac4b eab6bd81_eed5_f587_d978_ddb9914683a1["recursivelyApplyViewTransitions()"] eab6bd81_eed5_f587_d978_ddb9914683a1 -->|calls| 957c05d9_3d16_8881_1cdf_919ea0e11411 a02a7008_ceb2_6637_4690_9f424ed035b3["measureExitViewTransitions()"] 957c05d9_3d16_8881_1cdf_919ea0e11411 -->|calls| a02a7008_ceb2_6637_4690_9f424ed035b3 f5399df0_4b1f_a7ec_8c95_a07437cebf61["recursivelyRestoreNew()"] 957c05d9_3d16_8881_1cdf_919ea0e11411 -->|calls| f5399df0_4b1f_a7ec_8c95_a07437cebf61 eab6bd81_eed5_f587_d978_ddb9914683a1["recursivelyApplyViewTransitions()"] 957c05d9_3d16_8881_1cdf_919ea0e11411 -->|calls| eab6bd81_eed5_f587_d978_ddb9914683a1 style 957c05d9_3d16_8881_1cdf_919ea0e11411 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-reconciler/src/ReactFiberApplyGesture.js lines 1132–1218
function applyViewTransitionsOnFiber(finishedWork: Fiber, current: Fiber) {
// The effect flag should be checked *after* we refine the type of fiber,
// because the fiber tag is more specific. An exception is any flag related
// to reconciliation, because those can be set on all fiber types.
switch (finishedWork.tag) {
case HostPortal: {
// TODO: Consider what should happen to Portals. For now we exclude them.
break;
}
case OffscreenComponent: {
const newState: OffscreenState | null = finishedWork.memoizedState;
const isHidden = newState !== null;
const wasHidden = current.memoizedState !== null;
if (!isHidden) {
if (wasHidden) {
measureExitViewTransitions(finishedWork);
recursivelyRestoreNew(finishedWork, finishedWork);
} else {
recursivelyApplyViewTransitions(finishedWork);
}
} else {
if (!wasHidden) {
// Was previously mounted as visible but is now hidden.
commitEnterViewTransitions(current, true);
}
}
break;
}
case ViewTransitionComponent: {
const prevContextChanged = viewTransitionContextChanged;
const prevCancelableChildren = pushViewTransitionCancelableScope();
viewTransitionContextChanged = false;
recursivelyApplyViewTransitions(finishedWork);
if (viewTransitionContextChanged) {
finishedWork.flags |= Update;
}
const inViewport = measureUpdateViewTransition(
current,
finishedWork,
true,
);
if ((finishedWork.flags & Update) === NoFlags || !inViewport) {
// If this boundary didn't update, then we may be able to cancel its children.
// We bubble them up to the parent set to be determined later if we can cancel.
// Similarly, if old and new state was outside the viewport, we can skip it
// even if it did update.
if (prevCancelableChildren === null) {
// Bubbling up this whole set to the parent.
} else {
// Merge with parent set.
// $FlowFixMe[method-unbinding]
prevCancelableChildren.push.apply(
prevCancelableChildren,
viewTransitionCancelableChildren,
);
popViewTransitionCancelableScope(prevCancelableChildren);
}
// TODO: If this doesn't end up canceled, because a parent animates,
// then we should probably issue an event since this instance is part of it.
} else {
const props: ViewTransitionProps = finishedWork.memoizedProps;
scheduleGestureTransitionEvent(finishedWork, props.onGestureUpdate);
// If this boundary did update, we cannot cancel its children so those are dropped.
popViewTransitionCancelableScope(prevCancelableChildren);
}
if ((finishedWork.flags & AffectedParentLayout) !== NoFlags) {
// This boundary changed size in a way that may have caused its parent to
// relayout. We need to bubble this information up to the parent.
viewTransitionContextChanged = true;
} else {
// Otherwise, we restore it to whatever the parent had found so far.
viewTransitionContextChanged = prevContextChanged;
}
const viewTransitionState: ViewTransitionState = finishedWork.stateNode;
viewTransitionState.clones = null; // Reset
break;
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does applyViewTransitionsOnFiber() do?
applyViewTransitionsOnFiber() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberApplyGesture.js.
Where is applyViewTransitionsOnFiber() defined?
applyViewTransitionsOnFiber() is defined in packages/react-reconciler/src/ReactFiberApplyGesture.js at line 1132.
What does applyViewTransitionsOnFiber() call?
applyViewTransitionsOnFiber() calls 3 function(s): measureExitViewTransitions, recursivelyApplyViewTransitions, recursivelyRestoreNew.
What calls applyViewTransitionsOnFiber()?
applyViewTransitionsOnFiber() is called by 1 function(s): recursivelyApplyViewTransitions.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free