@@ -526,36 +526,39 @@ export class SharedTransitionHelper {
526
526
}
527
527
528
528
static interactiveUpdate ( state : SharedTransitionState , interactiveState : PlatformTransitionInteractiveState , type : TransitionNavigationType , percent : number ) {
529
- if ( ! interactiveState ?. added ) {
530
- interactiveState . added = true ;
531
- for ( const p of state . instance . sharedElements . presented ) {
532
- p . view . opacity = 0 ;
533
- }
534
- for ( const p of state . instance . sharedElements . presenting ) {
535
- p . snapshot . alpha = p . endOpacity ;
536
- interactiveState . transitionContext . containerView . addSubview ( p . snapshot ) ;
537
- }
529
+ if ( interactiveState ) {
530
+ if ( ! interactiveState . added ) {
531
+ interactiveState . added = true ;
532
+ for ( const p of state . instance . sharedElements . presented ) {
533
+ p . view . opacity = 0 ;
534
+ }
535
+ for ( const p of state . instance . sharedElements . presenting ) {
536
+ p . snapshot . alpha = p . endOpacity ;
537
+ interactiveState . transitionContext . containerView . addSubview ( p . snapshot ) ;
538
+ }
538
539
539
- const pageStart = state . pageStart ;
540
+ const pageStart = state . pageStart ;
540
541
541
- const startFrame = getRectFromProps ( pageStart , getPageStartDefaultsForType ( type ) ) ;
542
- interactiveState . propertyAnimator = UIViewPropertyAnimator . alloc ( ) . initWithDurationDampingRatioAnimations ( 1 , 1 , ( ) => {
543
- for ( const p of state . instance . sharedElements . presenting ) {
544
- p . snapshot . frame = p . startFrame ;
545
- iOSUtils . copyLayerProperties ( p . snapshot , p . view . ios , p . propertiesToMatch as any ) ;
542
+ const startFrame = getRectFromProps ( pageStart , getPageStartDefaultsForType ( type ) ) ;
543
+ interactiveState . propertyAnimator = UIViewPropertyAnimator . alloc ( ) . initWithDurationDampingRatioAnimations ( 1 , 1 , ( ) => {
544
+ for ( const p of state . instance . sharedElements . presenting ) {
545
+ p . snapshot . frame = p . startFrame ;
546
+ iOSUtils . copyLayerProperties ( p . snapshot , p . view . ios , p . propertiesToMatch as any ) ;
546
547
547
- p . snapshot . alpha = 1 ;
548
- }
549
- state . instance . presented . view . alpha = isNumber ( state . pageReturn ?. opacity ) ? state . pageReturn ?. opacity : 0 ;
550
- state . instance . presented . view . frame = CGRectMake ( startFrame . x , startFrame . y , state . instance . presented . view . bounds . size . width , state . instance . presented . view . bounds . size . height ) ;
548
+ p . snapshot . alpha = 1 ;
549
+ }
550
+ state . instance . presented . view . alpha = isNumber ( state . pageReturn ?. opacity ) ? state . pageReturn ?. opacity : 0 ;
551
+ state . instance . presented . view . frame = CGRectMake ( startFrame . x , startFrame . y , state . instance . presented . view . bounds . size . width , state . instance . presented . view . bounds . size . height ) ;
552
+ } ) ;
553
+ }
554
+
555
+ interactiveState . propertyAnimator . fractionComplete = percent ;
556
+ SharedTransition . notifyEvent ( SharedTransition . interactiveUpdateEvent , {
557
+ id : state ?. instance ?. id ,
558
+ type,
559
+ percent,
551
560
} ) ;
552
561
}
553
- interactiveState . propertyAnimator . fractionComplete = percent ;
554
- SharedTransition . notifyEvent ( SharedTransition . interactiveUpdateEvent , {
555
- id : state ?. instance ?. id ,
556
- type,
557
- percent,
558
- } ) ;
559
562
}
560
563
561
564
static interactiveCancel ( state : SharedTransitionState , interactiveState : PlatformTransitionInteractiveState , type : TransitionNavigationType ) {
0 commit comments