MCPcopy
hub / github.com/facebook/react / updateViewTransition

Function updateViewTransition

packages/react-reconciler/src/ReactFiberBeginWork.js:3530–3578  ·  view source on GitHub ↗
(
  current: Fiber | null,
  workInProgress: Fiber,
  renderLanes: Lanes,
)

Source from the content-addressed store, hash-verified

3528}
3529
3530function updateViewTransition(
3531 current: Fiber | null,
3532 workInProgress: Fiber,
3533 renderLanes: Lanes,
3534) {
3535 const pendingProps: ViewTransitionProps = workInProgress.pendingProps;
3536 if (pendingProps.name != null && pendingProps.name !== 'auto') {
3537 // Explicitly named boundary. We track it so that we can pair it up with another explicit
3538 // boundary if we get deleted.
3539 workInProgress.flags |=
3540 current === null
3541 ? ViewTransitionNamedMount | ViewTransitionNamedStatic
3542 : ViewTransitionNamedStatic;
3543 } else {
3544 // The server may have used useId to auto-assign a generated name for this boundary.
3545 // We push a materialization to ensure child ids line up with the server.
3546 if (getIsHydrating()) {
3547 pushMaterializedTreeId(workInProgress);
3548 }
3549 }
3550 if (__DEV__) {
3551 // $FlowFixMe[prop-missing]
3552 if (pendingProps.className !== undefined) {
3553 const example =
3554 typeof pendingProps.className === 'string'
3555 ? JSON.stringify(pendingProps.className)
3556 : '{...}';
3557 if (!didWarnAboutClassNameOnViewTransition[example]) {
3558 didWarnAboutClassNameOnViewTransition[example] = true;
3559 console.error(
3560 '<ViewTransition> doesn\'t accept a "className" prop. It has been renamed to "default".\n' +
3561 '- <ViewTransition className=%s>\n' +
3562 '+ <ViewTransition default=%s>',
3563 example,
3564 example,
3565 );
3566 }
3567 }
3568 }
3569 if (current !== null && current.memoizedProps.name !== pendingProps.name) {
3570 // If the name changes, we schedule a ref effect to create a new ref instance.
3571 workInProgress.flags |= Ref | RefStatic;
3572 } else {
3573 markRef(current, workInProgress);
3574 }
3575 const nextChildren = pendingProps.children;
3576 reconcileChildren(current, workInProgress, nextChildren, renderLanes);
3577 return workInProgress.child;
3578}
3579
3580function updatePortalComponent(
3581 current: Fiber | null,

Callers 1

beginWorkFunction · 0.85

Calls 5

getIsHydratingFunction · 0.90
pushMaterializedTreeIdFunction · 0.90
markRefFunction · 0.85
reconcileChildrenFunction · 0.85
errorMethod · 0.65

Tested by

no test coverage detected