@@ -100,7 +100,8 @@ export class RNSharedElementTransition {
100
100
const {
101
101
element,
102
102
items,
103
- nodePosition /*, animation, resize, align*/
103
+ nodePosition,
104
+ animation /*, animation, resize, align*/
104
105
} = this ;
105
106
if ( ! element ) return ;
106
107
@@ -170,14 +171,38 @@ export class RNSharedElementTransition {
170
171
// interpolatedClipInsets = endClipInsets;
171
172
}
172
173
173
- this . updateView (
174
- 0 ,
175
- interpolatedLayout ,
176
- interpolatedStyle ,
177
- interpolatedContentLayout ,
178
- startLayout ,
179
- startContent
180
- ) ;
174
+ if (
175
+ animation === RNSharedElementAnimation . Move ||
176
+ animation === RNSharedElementAnimation . Fade ||
177
+ animation === RNSharedElementAnimation . FadeOut
178
+ ) {
179
+ const startOpacity =
180
+ animation === RNSharedElementAnimation . Move ? 1 : 1 - nodePosition ;
181
+ this . updateView (
182
+ 0 ,
183
+ interpolatedLayout ,
184
+ interpolatedStyle ,
185
+ interpolatedContentLayout ,
186
+ startLayout ,
187
+ startContent ,
188
+ startOpacity
189
+ ) ;
190
+ }
191
+ if (
192
+ animation === RNSharedElementAnimation . Fade ||
193
+ animation === RNSharedElementAnimation . FadeIn
194
+ ) {
195
+ const endOpacity = nodePosition ;
196
+ this . updateView (
197
+ 1 ,
198
+ interpolatedLayout ,
199
+ interpolatedStyle ,
200
+ interpolatedContentLayout ,
201
+ endLayout ,
202
+ endContent ,
203
+ endOpacity
204
+ ) ;
205
+ }
181
206
}
182
207
183
208
private updateView (
@@ -188,7 +213,8 @@ export class RNSharedElementTransition {
188
213
interpolatedContentLayout : Rect ,
189
214
// @ts -ignore
190
215
originalLayout : Rect ,
191
- content : RNSharedElementContent | null
216
+ content : RNSharedElementContent | null ,
217
+ opacity : number
192
218
) {
193
219
// Find / create view
194
220
let view = this . views [ index ] ;
@@ -208,5 +234,6 @@ export class RNSharedElementTransition {
208
234
if ( ! content || ! content . element ) return ;
209
235
view . contentElement = ( content . element as any ) . cloneNode ( true ) ;
210
236
}
237
+ ( view . contentElement as any ) . style . opacity = opacity ;
211
238
}
212
239
}
0 commit comments