Bladeren bron

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

Fix crash on android api level less than 21
Gaëtan Renaudeau 5 jaren geleden
bovenliggende
commit
30a91f1627
No account linked to committer's email address
1 gewijzigde bestanden met toevoegingen van 9 en 7 verwijderingen
  1. 9
    7
      android/src/main/java/fr/greweb/reactnativeviewshot/DebugViews.java

+ 9
- 7
android/src/main/java/fr/greweb/reactnativeviewshot/DebugViews.java Bestand weergeven

@@ -148,13 +148,15 @@ public final class DebugViews {
148 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 162
             if (1.0f != v.getScaleX() || 1.0f != v.getScaleY()) {