Trying to add third party module, react native can't find item in NativeModules


#1

I am using Expokit, and it was requested that I use the tipsi-stripe library instead of the payment api built into expo. I’ve just about got everything working, seems to build okay in iOS, but in Android, I get the following message:
Native module AccessibilityInfoModule tried to override AccessibilityInfoModule for module name AccessibilityInfo (EDIT: got this figured out, see below)

I am assuming this is because the Payment API in Expo is built on top of tipsi originally, as I have had to exclude some modules in my build.gradle file, but how would I go about resolving this? any ideas?


ExpoKit (SDK 24) Link Native Modules Problem - Android
#3

Alright, so I thought I would go into detail. I have everything working and setup, builds working on iOS and Android, but when I try and run the app, calling stripe from the tipsi-stripe module, I get an error stating that stripe is undefined, in both Android and iOS. Android is setup pretty much exactly as it says in the docs, and how it links by running react-native link. The only thing I did differently, was I didn’t include the Stripe package in my MainApplication.java, as it is already called in Expo, and will result in the error I initially had, what I did end up doing was this, in my app/build.gradle, I set it up like this:

dependencies {
    compile project(':tipsi-stripe')
  compile fileTree(dir: 'libs', include: ['*.jar'])
  testCompile 'junit:junit:4.12'
  compile 'com.android.support:appcompat-v7:26.1.0'
  compile 'com.android.support:multidex:1.0.1'

  
  compile('host.exp.exponent:expoview:23.0.0@aar') {
    exclude group: 'com.facebook.android', module: 'facebook-android-sdk'
    exclude group: 'com.facebook.android', module: 'audience-network-sdk'
    exclude group: 'io.nlopez.smartlocation', module: 'library'
    exclude group: 'com.github.thefuntasty', module: 'CreditCardEntry'
    exclude group: 'com.gettipsi', module: 'stripeview'
    exclude group: 'com.stripe', module: 'stripe-android'
    transitive = true
  }

  compile 'com.facebook.android:facebook-android-sdk:4.+'
  compile('com.facebook.android:audience-network-sdk:4.+') {
    exclude module: 'play-services-ads'
  }
  compile('io.nlopez.smartlocation:library:3.2.11') {
    transitive = false
  }
  compile project(':tipsi-stripe')

it seems fine here, and then on the ios side, I have this in my pod file:

...
 pod 'GLog',
    :podspec => "../node_modules/react-native/third-party-podspecs/GLog.podspec",
    :inhibit_warnings => true
  # Add payments
  pod 'Stripe', '~> 11.2.0'
  # Payment dependancies
  pod 'Firebase/Core'
  pod 'Firebase/Auth'
  pod 'Firebase/Crash'
  pod 'Firebase/Database'
  pod 'Firebase/Firestore'
  pod 'Firebase/Messaging'
  pod 'Firebase/Performance'
  pod 'Firebase/Storage'

  pod 'tipsi-stripe', :path => '../node_modules/tipsi-stripe/tipsi-stripe.podspec'

I’ve also tried variants of that tipsi-stripe pod, but it didn’t make any difference. Tried also running react-native link with and without this, it says it’s been linked, but I run into issues on this line in the tipsi module:
const { TPSStripeManager } = NativeModules <- this always returns undefined.

Any ideas as to why this is happening, or where I would look to modify the code in the library to get it to work?


#4

I am having a similar issue with react-native-background-geolocation and react-native-onesignal on Android (SDK 24 detached). However iOS things seem to be working properly.


#5

Having the same issue.


#6

Hey everyone thanks for the report. I just pushed out a new build, if you run exp detach again you’ll get the new code. Can you let me know if that works for you?


#7

Thank you @jesse, works now!