@@ -50,6 +50,7 @@ export class SharedTransitionHelper {
50
50
console . log ( `2. Take snapshots of shared elements and position them based on presenting view:` ) ;
51
51
}
52
52
53
+ const pageOut = state . pageOut ;
53
54
const pageStart = state . pageStart ;
54
55
55
56
const startFrame = getRectFromProps ( pageStart , getPageStartDefaultsForType ( type ) ) ;
@@ -273,6 +274,14 @@ export class SharedTransitionHelper {
273
274
const endFrame = getRectFromProps ( pageEnd ) ;
274
275
transition . presented . view . frame = CGRectMake ( endFrame . x , endFrame . y , endFrame . width , endFrame . height ) ;
275
276
277
+ if ( pageOut ) {
278
+ if ( isNumber ( pageOut . opacity ) ) {
279
+ transition . presenting . view . alpha = pageOut ?. opacity ;
280
+ }
281
+
282
+ const outFrame = getRectFromProps ( pageOut ) ;
283
+ transition . presenting . view . frame = CGRectMake ( outFrame . x , outFrame . y , outFrame . width , outFrame . height ) ;
284
+ }
276
285
// animate page properties to the following:
277
286
// https://stackoverflow.com/a/27997678/1418981
278
287
// In order to have proper layout. Seems mostly needed when presenting.
@@ -368,6 +377,7 @@ export class SharedTransitionHelper {
368
377
console . log ( `2. Add back previously stored sharedElements to dismiss:` ) ;
369
378
}
370
379
380
+ const pageOut = state . pageOut ;
371
381
const pageEnd = state . pageEnd ;
372
382
const pageEndTags = pageEnd ?. sharedTransitionTags || { } ;
373
383
const pageReturn = state . pageReturn ;
@@ -457,6 +467,14 @@ export class SharedTransitionHelper {
457
467
const endFrame = getRectFromProps ( pageReturn , getPageStartDefaultsForType ( type ) ) ;
458
468
transition . presented . view . frame = CGRectMake ( endFrame . x , endFrame . y , endFrame . width , endFrame . height ) ;
459
469
470
+ if ( pageOut ) {
471
+ // always return to defaults if pageOut had been used
472
+ transition . presenting . view . alpha = 1 ;
473
+
474
+ const outFrame = getRectFromProps ( null ) ;
475
+ transition . presenting . view . frame = CGRectMake ( 0 , 0 , outFrame . width , outFrame . height ) ;
476
+ }
477
+
460
478
for ( const presenting of transition . sharedElements . presenting ) {
461
479
iOSUtils . copyLayerProperties ( presenting . snapshot , presenting . view . ios , presenting . propertiesToMatch as any ) ;
462
480
presenting . snapshot . frame = presenting . startFrame ;
0 commit comments