stripe-react-native: Build error with RN 0.73
Describe the bug After upgrading to React Native 0.73 I saw the following build error.
> Task :stripe_stripe-react-native:compileDebugKotlin FAILED
e: file:///home/johnf/work/gladly/mobile/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/CardFormView.kt:31:70 Unresolved reference: style
To Reproduce Steps to reproduce the behavior:
- Create a new 0.73 RN app
- Follow the stripe-react-native setup instructions
- yarn android
Expected behavior No Compile errors
Additional context
The code in question is
class CardFormView(context: ThemedReactContext) : FrameLayout(context) {
private var cardForm: CardFormView = CardFormView(context, null, R.style.StripeCardFormView_Borderless)
private var mEventDispatcher: EventDispatcher? = context.getNativeModule(UIManagerModule::class.java)?.eventDispatcher
private var dangerouslyGetFullCardDetails: Boolean = false
private var currentFocusedField: String? = null
I can’t find style
defined in any of the resource files. Not sure why it wasn’t a compile error before RN 0.73.0
My quick fix is to apply the following diff
diff --git a/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/CardFormView.kt b/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/CardFormView.kt
index b78d457..6e485ce 100644
--- a/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/CardFormView.kt
+++ b/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/CardFormView.kt
@@ -28,7 +28,7 @@ import com.stripe.android.view.CardFormView
import com.stripe.android.view.CardInputListener
class CardFormView(context: ThemedReactContext) : FrameLayout(context) {
- private var cardForm: CardFormView = CardFormView(context, null, R.style.StripeCardFormView_Borderless)
+ private var cardForm: CardFormView = CardFormView(context)
private var mEventDispatcher: EventDispatcher? = context.getNativeModule(UIManagerModule::class.java)?.eventDispatcher
private var dangerouslyGetFullCardDetails: Boolean = false
private var currentFocusedField: String? = null
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Reactions: 12
- Comments: 17 (6 by maintainers)
Commits related to this issue
- fix: RN 0.73 Build error #1578 — committed to jgillick/stripe-react-native by jgillick 7 months ago
- fix: RN 0.73 Build error #1578 (#1579) — committed to stripe/stripe-react-native by jgillick 6 months ago
I believe this will fix it correctly (taken from the Flutter fix of the same bug)
CC @mihailo-misic
would you mind release a version to fix this error
@divyanshkumarsharma The PR (https://github.com/stripe/stripe-react-native/pull/1579) is in review now. If you need the fix sooner, consider using patch-package and the patch I included in my comment above. This should unblock you. That’s what I’m doing in my project until this is released in the next version.
Hi @johnf I’m also having this issue right now.
The fix you’re suggesting is unfortunately not viable for me.
These are the versions of the relevant modules that I’m using:
0.73.0
0.35.0
1.8.22
(also tried:1.8.20
,1.8.0
, and1.7.0
)Hello!
I’m using
react-native
v0.73.0 (reverted from v0.75.0) and@stripe/stripe-react-native
v0.35.0 but I keep getting this compilation error.@ahmadAlMezaal which version-combination did it for ya’?
@TrustyTechSG Until they release the fix, you can unblock your project by either using patch-package or installing the package using the git commit hash (
f1fe1252d27a1e551a195d0ce9796c4810cec0e9
in yourpackage.json
file.Sorry for not providing the logs