Skip to content

Commit f8f2bf2

Browse files
Fix Android color parsing when values are strings
Bundle.getBundle() throws ClassCastException when value is a string. Wrapped in try-catch to mirror React Native's ReadableMap behavior.
1 parent 2213418 commit f8f2bf2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/stripe_android/android/src/main/kotlin/com/reactnativestripesdk/PaymentSheetAppearance.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,12 @@ private fun dynamicColorFromParams(
511511
}
512512

513513
// First check if it's a nested Bundle { "light": "#RRGGBB", "dark": "#RRGGBB" }
514-
val colorBundle = params.getBundle(key)
514+
val colorBundle =
515+
try {
516+
params.getBundle(key)
517+
} catch (e: ClassCastException) {
518+
null
519+
}
515520
if (colorBundle != null) {
516521
val isDark =
517522
(

0 commit comments

Comments
 (0)