( root: FiberRoot, finishedWork: Fiber, recoverableErrors: null | Array<CapturedValue<mixed>>, suspendedState: null | SuspendedState, renderEndTime: number, // Profiling-only )
| 4238 | } |
| 4239 | |
| 4240 | function commitGestureOnRoot( |
| 4241 | root: FiberRoot, |
| 4242 | finishedWork: Fiber, |
| 4243 | recoverableErrors: null | Array<CapturedValue<mixed>>, |
| 4244 | suspendedState: null | SuspendedState, |
| 4245 | renderEndTime: number, // Profiling-only |
| 4246 | ): void { |
| 4247 | // We assume that the gesture we just rendered was the first one in the queue. |
| 4248 | const finishedGesture = root.pendingGestures; |
| 4249 | if (finishedGesture === null) { |
| 4250 | // We must have already cancelled this gesture before we had a chance to |
| 4251 | // render it. Let's schedule work on the next set of lanes. |
| 4252 | ensureRootIsScheduled(root); |
| 4253 | return; |
| 4254 | } |
| 4255 | deleteScheduledGesture(root, finishedGesture); |
| 4256 | |
| 4257 | if (enableProfilerTimer && enableComponentPerformanceTrack) { |
| 4258 | startAnimating(pendingEffectsLanes); |
| 4259 | } |
| 4260 | |
| 4261 | const prevTransition = ReactSharedInternals.T; |
| 4262 | ReactSharedInternals.T = null; |
| 4263 | const previousPriority = getCurrentUpdatePriority(); |
| 4264 | setCurrentUpdatePriority(DiscreteEventPriority); |
| 4265 | const prevExecutionContext = executionContext; |
| 4266 | executionContext |= CommitContext; |
| 4267 | try { |
| 4268 | insertDestinationClones(root, finishedWork); |
| 4269 | } finally { |
| 4270 | // Reset the priority to the previous non-sync value. |
| 4271 | executionContext = prevExecutionContext; |
| 4272 | setCurrentUpdatePriority(previousPriority); |
| 4273 | ReactSharedInternals.T = prevTransition; |
| 4274 | } |
| 4275 | pendingTransitionTypes = finishedGesture.types; |
| 4276 | pendingEffectsStatus = PENDING_GESTURE_MUTATION_PHASE; |
| 4277 | |
| 4278 | pendingViewTransition = finishedGesture.running = startGestureTransition( |
| 4279 | suspendedState, |
| 4280 | root.containerInfo, |
| 4281 | finishedGesture.provider, |
| 4282 | finishedGesture.rangeStart, |
| 4283 | finishedGesture.rangeEnd, |
| 4284 | pendingTransitionTypes, |
| 4285 | flushGestureMutations, |
| 4286 | flushGestureAnimations, |
| 4287 | reportViewTransitionError, |
| 4288 | enableProfilerTimer |
| 4289 | ? // This callback fires after "pendingEffects" so we need to snapshot the arguments. |
| 4290 | finishedViewTransition.bind(null, pendingEffectsLanes) |
| 4291 | : (null: any), |
| 4292 | ); |
| 4293 | } |
| 4294 | |
| 4295 | function flushGestureMutations(): void { |
| 4296 | if (!enableGestureTransition) { |
no test coverage detected