44 SharedElementsConfig ,
55 SharedElementAnimatedValue ,
66 SharedElementTransitionProps ,
7- NavigationProp ,
87} from './types' ;
98import { normalizeSharedElementsConfig } from './utils' ;
109
@@ -13,35 +12,27 @@ export type SharedElementRendererUpdateHandler = () => any;
1312export interface ISharedElementRendererData {
1413 startTransition ( animValue : SharedElementAnimatedValue ) : void ;
1514 endTransition ( ) : void ;
16- willActivateScene (
17- sceneData : SharedElementSceneData ,
18- navigation : NavigationProp
19- ) : void ;
20- didActivateScene (
21- sceneData : SharedElementSceneData ,
22- navigation : NavigationProp
23- ) : void ;
15+ willActivateScene ( sceneData : SharedElementSceneData ) : void ;
16+ didActivateScene ( sceneData : SharedElementSceneData ) : void ;
2417}
2518
2619function getSharedElements (
2720 sceneData : SharedElementSceneData ,
28- navigation : NavigationProp ,
29- otherNavigation : NavigationProp ,
21+ otherSceneData : SharedElementSceneData ,
3022 show : boolean
3123) : SharedElementsConfig | null {
3224 const { sharedElements } = sceneData . Component ;
3325 if ( ! sharedElements ) return null ;
3426 // TODO push/pop distinction?
3527 return normalizeSharedElementsConfig (
36- sharedElements ( navigation , otherNavigation , show )
28+ sharedElements ( sceneData . navigation , otherSceneData . navigation , show )
3729 ) ;
3830}
3931
4032export default class SharedElementRendererData
4133 implements ISharedElementRendererData {
4234 private sceneData : SharedElementSceneData | null = null ;
4335 private prevSceneData : SharedElementSceneData | null = null ;
44- private prevNavigation : NavigationProp | null = null ;
4536 private updateSubscribers = new Set < SharedElementRendererUpdateHandler > ( ) ;
4637 private sceneSubscription : SharedElementEventSubscription | null = null ;
4738 private sharedElements : SharedElementsConfig = [ ] ;
@@ -55,25 +46,17 @@ export default class SharedElementRendererData
5546 // Nothing to do
5647 }
5748
58- willActivateScene (
59- sceneData : SharedElementSceneData ,
60- navigation : NavigationProp
61- ) : void {
49+ willActivateScene ( sceneData : SharedElementSceneData ) : void {
6250 /*console.log(
6351 'SharedElementRendererData.willActivateScene: ',
6452 sceneData.name,
6553 ', previous: ',
6654 this.prevSceneData ? this.prevSceneData.name : ''
6755 );*/
68- if ( ! this . prevSceneData || ! this . prevNavigation ) return ;
56+ if ( ! this . prevSceneData ) return ;
6957 const sharedElements =
70- getSharedElements ( sceneData , navigation , this . prevNavigation , true ) ||
71- getSharedElements (
72- this . prevSceneData ,
73- this . prevNavigation ,
74- navigation ,
75- false
76- ) ;
58+ getSharedElements ( sceneData , this . prevSceneData , true ) ||
59+ getSharedElements ( this . prevSceneData , sceneData , false ) ;
7760 if ( sharedElements && sharedElements . length ) {
7861 // console.log('sharedElements: ', sharedElements, sceneData);
7962 this . sceneData = sceneData ;
@@ -86,17 +69,13 @@ export default class SharedElementRendererData
8669 }
8770 }
8871
89- didActivateScene (
90- sceneData : SharedElementSceneData ,
91- navigation : NavigationProp
92- ) : void {
72+ didActivateScene ( sceneData : SharedElementSceneData ) : void {
9373 //console.log('SharedElementRendererData.didActivateScene: ', sceneData.name);
9474 if ( this . sceneSubscription ) {
9575 this . sceneSubscription . remove ( ) ;
9676 this . sceneSubscription = null ;
9777 }
9878 this . prevSceneData = sceneData ;
99- this . prevNavigation = navigation ;
10079 if ( this . sceneData ) {
10180 this . sceneData = null ;
10281 if ( this . sharedElements . length ) {
0 commit comments