mirror of
				https://github.com/NativeScript/NativeScript.git
				synced 2025-11-04 12:58:38 +08:00 
			
		
		
		
	fix(shared-transition): race condition with interactive updates (#10312)
This commit is contained in:
		@ -526,7 +526,8 @@ export class SharedTransitionHelper {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	static interactiveUpdate(state: SharedTransitionState, interactiveState: PlatformTransitionInteractiveState, type: TransitionNavigationType, percent: number) {
 | 
			
		||||
		if (!interactiveState?.added) {
 | 
			
		||||
		if (interactiveState) {
 | 
			
		||||
			if (!interactiveState.added) {
 | 
			
		||||
				interactiveState.added = true;
 | 
			
		||||
				for (const p of state.instance.sharedElements.presented) {
 | 
			
		||||
					p.view.opacity = 0;
 | 
			
		||||
@ -550,6 +551,7 @@ export class SharedTransitionHelper {
 | 
			
		||||
					state.instance.presented.view.frame = CGRectMake(startFrame.x, startFrame.y, state.instance.presented.view.bounds.size.width, state.instance.presented.view.bounds.size.height);
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			interactiveState.propertyAnimator.fractionComplete = percent;
 | 
			
		||||
			SharedTransition.notifyEvent(SharedTransition.interactiveUpdateEvent, {
 | 
			
		||||
				id: state?.instance?.id,
 | 
			
		||||
@ -557,6 +559,7 @@ export class SharedTransitionHelper {
 | 
			
		||||
				percent,
 | 
			
		||||
			});
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	static interactiveCancel(state: SharedTransitionState, interactiveState: PlatformTransitionInteractiveState, type: TransitionNavigationType) {
 | 
			
		||||
		if (state?.instance && interactiveState?.added && interactiveState?.propertyAnimator) {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user