5
5
import android .view .ViewParent ;
6
6
import android .view .ViewGroup ;
7
7
import android .graphics .Rect ;
8
+ import android .graphics .Matrix ;
8
9
9
10
class RNSharedElementTransitionItem {
10
11
static private String LOG_TAG = "RNSharedElementTransitionItem" ;
@@ -109,10 +110,15 @@ View getView() {
109
110
Rect getClippedLayout () {
110
111
if (mClippedLayoutCache != null ) return mClippedLayoutCache ;
111
112
if (mStyle == null ) return null ;
113
+
112
114
View view = getView ();
113
115
View ancestorView = mNode .getAncestorView ();
114
- int [] ancestorLocation = new int [2 ];
115
- ancestorView .getLocationOnScreen (ancestorLocation );
116
+
117
+ // Get ancestor transform
118
+ float [] f = new float [9 ];
119
+ mStyle .ancestorTransform .getValues (f );
120
+ int ancestorTranslateX = (int ) f [Matrix .MTRANS_X ];
121
+ int ancestorTranslateY = (int ) f [Matrix .MTRANS_Y ];
116
122
117
123
// Get visible area (some parts may be clipped in a scrollview or something)
118
124
Rect clippedLayout = new Rect (mStyle .layout );
@@ -123,8 +129,8 @@ Rect getClippedLayout() {
123
129
if (!(parentView instanceof ViewGroup )) break ;
124
130
ViewGroup viewGroup = (ViewGroup ) parentView ;
125
131
viewGroup .getLocationOnScreen (location );
126
- location [0 ] -= ancestorLocation [ 0 ] ;
127
- location [1 ] -= ancestorLocation [ 1 ] ;
132
+ location [0 ] -= ancestorTranslateX ;
133
+ location [1 ] -= ancestorTranslateY ;
128
134
129
135
bounds .left = location [0 ];
130
136
bounds .top = location [1 ];
0 commit comments