File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -166,6 +166,19 @@ function createSharedElementScene(
166166 this . sceneData . setAncestor ( nodeFromRef ( ref ) ) ;
167167 } ;
168168
169+ private getSharedElements ( ) : SharedElementsConfig | null {
170+ const { navigation } = this . props ;
171+ // @ts -ignore
172+ let sharedElements = navigation . getParam ( 'sharedElements' ) || Component . sharedElements ;
173+ if ( ! sharedElements ) return null ;
174+ if ( typeof sharedElements === 'function' ) {
175+ sharedElements = sharedElements ( navigation ) ;
176+ }
177+ return sharedElements
178+ ? normalizeSharedElementsConfig ( sharedElements )
179+ : null ;
180+ }
181+
169182 private onWillFocus = ( ) => {
170183 const { navigation } = this . props ;
171184 /*console.log(
@@ -182,9 +195,7 @@ function createSharedElementScene(
182195 const transitionSpec2 = transitionSpec . config
183196 ? transitionSpec
184197 : fromLegacyNavigationTransitionSpec ( transitionSpec ) ;
185- const sharedElements = normalizeSharedElementsConfig (
186- navigation . getParam ( 'sharedElements' )
187- ) ;
198+ const sharedElements = this . getSharedElements ( ) ;
188199 if ( this . rendererData && sharedElements ) {
189200 const { timing, config } = transitionSpec2 ;
190201 this . rendererData . willActivateScene (
You can’t perform that action at this time.
0 commit comments