Skip to content

Commit 30a91f1

Browse files
authored
Merge pull request #240 from Taym95/@taym95/fix/android-crash
Fix crash on android api level less than 21
2 parents 81d78ac + 6fc6482 commit 30a91f1

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

android/src/main/java/fr/greweb/reactnativeviewshot/DebugViews.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,15 @@ private static String dumpProperties(@NonNull final Resources r, @NonNull final
148148
.append("]");
149149
}
150150
}
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+
}
158160
}
159161

160162
if (1.0f != v.getScaleX() || 1.0f != v.getScaleY()) {

0 commit comments

Comments
 (0)