ソースを参照

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

Fix crash on android api level less than 21
Gaëtan Renaudeau 4 年 前
コミット
30a91f1627
No account linked to committer's email address
共有1 個のファイルを変更した9 個の追加7 個の削除を含む
  1. 9
    7
      android/src/main/java/fr/greweb/reactnativeviewshot/DebugViews.java

+ 9
- 7
android/src/main/java/fr/greweb/reactnativeviewshot/DebugViews.java ファイルの表示

@@ -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()) {