21
21
22
22
public class RNSharedElementTransition extends ViewGroup {
23
23
static private String LOG_TAG = "RNSharedElementTransition" ;
24
+ static private Rect EMPTY_RECT = new Rect ();
24
25
25
26
enum Item {
26
27
START (0 ),
@@ -180,15 +181,17 @@ private void updateLayout() {
180
181
RNSharedElementContent endContent = endItem .getContent ();
181
182
182
183
// Get layout
183
- Rect startLayout = (startStyle != null ) ? startStyle .layout : new Rect ();
184
- Rect endLayout = (endStyle != null ) ? endStyle .layout : new Rect ();
184
+ Rect startLayout = (startStyle != null ) ? startStyle .layout : EMPTY_RECT ;
185
+ Rect startFrame = (startStyle != null ) ? startStyle .frame : EMPTY_RECT ;
186
+ Rect endLayout = (endStyle != null ) ? endStyle .layout : EMPTY_RECT ;
187
+ Rect endFrame = (endStyle != null ) ? endStyle .frame : EMPTY_RECT ;
185
188
Rect parentLayout = new Rect (startLayout );
186
189
parentLayout .union (endLayout );
187
190
188
191
// Get clipped areas
189
- Rect startClippedLayout = (startStyle != null ) ? startItem .getClippedLayout () : new Rect () ;
192
+ Rect startClippedLayout = (startStyle != null ) ? startItem .getClippedLayout () : EMPTY_RECT ;
190
193
Rect startClipInsets = getClipInsets (startLayout , startClippedLayout );
191
- Rect endClippedLayout = (endStyle != null ) ? endItem .getClippedLayout () : new Rect () ;
194
+ Rect endClippedLayout = (endStyle != null ) ? endItem .getClippedLayout () : EMPTY_RECT ;
192
195
Rect endClipInsets = getClipInsets (endLayout , endClippedLayout );
193
196
194
197
// Get interpolated layout
@@ -260,8 +263,9 @@ private void updateLayout() {
260
263
mStartView .updateViewAndDrawable (
261
264
interpolatedLayout ,
262
265
parentLayout ,
263
- startContent ,
264
266
startLayout ,
267
+ startFrame ,
268
+ startContent ,
265
269
interpolatedStyle ,
266
270
startAlpha ,
267
271
mResize ,
@@ -275,8 +279,9 @@ private void updateLayout() {
275
279
mEndView .updateViewAndDrawable (
276
280
interpolatedLayout ,
277
281
parentLayout ,
278
- endContent ,
279
282
endLayout ,
283
+ endFrame ,
284
+ endContent ,
280
285
interpolatedStyle ,
281
286
endAlpha ,
282
287
mResize ,
@@ -464,4 +469,4 @@ private void fireMeasureEvent(String name, RNSharedElementTransitionItem item, R
464
469
"onMeasureNode" ,
465
470
eventData );
466
471
}
467
- }
472
+ }
0 commit comments