Browse Source

Merge pull request #240 from Taym95/@taym95/fix/android-crash

Fix crash on android api level less than 21
Gaëtan Renaudeau 4 years ago
parent
commit
30a91f1627
No account linked to committer's email address

+ 9
- 7
android/src/main/java/fr/greweb/reactnativeviewshot/DebugViews.java View File

148
                             .append("]");
148
                             .append("]");
149
                 }
149
                 }
150
             }
150
             }
151
-
152
-            if (0.0f != v.getTranslationX() || 0.0f != v.getTranslationY() || 0.0f != v.getTranslationZ()) {
153
-                sb.append(", translate=[")
154
-                        .append(v.getTranslationX()).append(",")
155
-                        .append(v.getTranslationY()).append(",")
156
-                        .append(v.getTranslationZ())
157
-                        .append("]");
151
+            
152
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
153
+                if (0.0f != v.getTranslationX() || 0.0f != v.getTranslationY() || 0.0f != v.getTranslationZ()) {
154
+                    sb.append(", translate=[")
155
+                            .append(v.getTranslationX()).append(",")
156
+                            .append(v.getTranslationY()).append(",")
157
+                            .append(v.getTranslationZ())
158
+                            .append("]");
159
+                }
158
             }
160
             }
159
 
161
 
160
             if (1.0f != v.getScaleX() || 1.0f != v.getScaleY()) {
162
             if (1.0f != v.getScaleX() || 1.0f != v.getScaleY()) {