MCPcopy Index your code
hub / github.com/react/react / flushGestureAnimations

Function flushGestureAnimations

packages/react-reconciler/src/ReactFiberWorkLoop.js:4324–4381  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4322}
4323
4324function flushGestureAnimations(): void {
4325 if (!enableGestureTransition) {
4326 return;
4327 }
4328 // If we get canceled before we start we might not have applied
4329 // mutations yet. We need to apply them first.
4330 flushGestureMutations();
4331 if (pendingEffectsStatus !== PENDING_GESTURE_ANIMATION_PHASE) {
4332 return;
4333 }
4334
4335 const lanes = pendingEffectsLanes;
4336
4337 if (enableProfilerTimer && enableComponentPerformanceTrack) {
4338 // Update the new commitEndTime to when we started the animation.
4339 recordCommitEndTime();
4340 logStartViewTransitionYieldPhase(
4341 pendingEffectsRenderEndTime,
4342 commitEndTime,
4343 pendingDelayedCommitReason === ABORTED_VIEW_TRANSITION_COMMIT,
4344 animatingTask,
4345 );
4346 if (pendingDelayedCommitReason !== ABORTED_VIEW_TRANSITION_COMMIT) {
4347 pendingDelayedCommitReason = ANIMATION_STARTED_COMMIT;
4348 }
4349 }
4350
4351 pendingEffectsStatus = NO_PENDING_EFFECTS;
4352 const root = pendingEffectsRoot;
4353 const finishedWork = pendingFinishedWork;
4354 pendingEffectsRoot = (null: any); // Clear for GC purposes.
4355 pendingFinishedWork = (null: any); // Clear for GC purposes.
4356 pendingEffectsLanes = NoLanes;
4357
4358 pendingViewTransition = null; // The view transition has now fully started.
4359
4360 const prevTransition = ReactSharedInternals.T;
4361 ReactSharedInternals.T = null;
4362 const previousPriority = getCurrentUpdatePriority();
4363 setCurrentUpdatePriority(DiscreteEventPriority);
4364 const prevExecutionContext = executionContext;
4365 executionContext |= CommitContext;
4366 try {
4367 startGestureAnimations(root, finishedWork);
4368 } finally {
4369 // Reset the priority to the previous non-sync value.
4370 executionContext = prevExecutionContext;
4371 setCurrentUpdatePriority(previousPriority);
4372 ReactSharedInternals.T = prevTransition;
4373 }
4374
4375 if (enableProfilerTimer && enableComponentPerformanceTrack) {
4376 finalizeRender(lanes, commitEndTime);
4377 }
4378
4379 // Now that we've rendered this lane. Start working on the next lane.
4380 ensureRootIsScheduled(root);
4381}

Callers 1

flushPendingEffectsFunction · 0.85

Calls 8

recordCommitEndTimeFunction · 0.90
getCurrentUpdatePriorityFunction · 0.90
setCurrentUpdatePriorityFunction · 0.90
startGestureAnimationsFunction · 0.90
ensureRootIsScheduledFunction · 0.90
flushGestureMutationsFunction · 0.85
finalizeRenderFunction · 0.85

Tested by

no test coverage detected