2
2
3
3
import java .util .Locale ;
4
4
5
+ import android .util .Log ;
5
6
import android .graphics .Rect ;
6
7
import android .graphics .Color ;
7
8
import android .graphics .Matrix ;
17
18
import com .facebook .react .modules .i18nmanager .I18nUtil ;
18
19
19
20
public class RNSharedElementStyle {
21
+ static private String LOG_TAG = "RNSharedElementStyle" ;
22
+
20
23
static int PROP_OPACITY = 1 << 0 ;
21
24
static int PROP_ELEVATION = 1 << 1 ;
22
25
static int PROP_BACKGROUND_COLOR = 1 << 2 ;
@@ -131,13 +134,14 @@ static ScaleType getInterpolatingScaleType(RNSharedElementStyle style1, RNShared
131
134
return scaleType ;
132
135
}
133
136
134
- static Matrix getAbsoluteViewTransform (View view ) {
137
+ static Matrix getAbsoluteViewTransform (View view , boolean failIfNotMounted ) {
135
138
Matrix matrix = new Matrix (view .getMatrix ());
136
139
float [] vals = new float [9 ];
137
140
matrix .getValues (vals );
138
141
139
142
float [] vals2 = new float [9 ];
140
143
ViewParent parentView = view .getParent ();
144
+
141
145
while (parentView != null && parentView instanceof View ) {
142
146
Matrix parentMatrix = ((View )parentView ).getMatrix ();
143
147
parentMatrix .getValues (vals2 );
@@ -154,7 +158,9 @@ static Matrix getAbsoluteViewTransform(View view) {
154
158
155
159
parentView = parentView .getParent ();
156
160
}
157
- if (parentView == null ) return null ;
161
+ if (parentView == null && failIfNotMounted ) {
162
+ return null ;
163
+ }
158
164
matrix .setValues (vals );
159
165
return matrix ;
160
166
}
0 commit comments