Skip to content

Commit c6d8b8f

Browse files
authored
fix(android): support react native 0.77 (#117)
* fix(android): support react native 0.77 * chore: use null check instead of cast * chore: add suppression comment for react native < 0.77
1 parent 298aec7 commit c6d8b8f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ class TrueSheetViewManager : ViewGroupManager<TrueSheetView>() {
107107
for (i in 0 until minOf(sizes.size(), 3)) {
108108
when (sizes.getType(i)) {
109109
ReadableType.Number -> result.add(sizes.getDouble(i))
110-
ReadableType.String -> result.add(sizes.getString(i))
110+
// React Native < 0.77 used String for getString, but 0.77
111+
// changed it to String?. Suppress the error for older APIs.
112+
@Suppress("UNNECESSARY_SAFE_CALL")
113+
ReadableType.String -> sizes.getString(i)?.let { result.add(it) }
111114
else -> Log.d(TAG, "Invalid type")
112115
}
113116
}

0 commit comments

Comments
 (0)