Linking native dependencies
For react-native version 0.59 and below, it is necessary to link the native libraries into react-native.

Automatic

The following bash command will automatically link react-native-cardscan into your react-native app.
1
$ react-native link react-native-cardscan
Copied!

Manual

If instead, you want to manually link react-native-cardscan, perform the following steps.
iOS
  1. 1.
    In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. 2.
    Go to node_modulesreact-native-cardscan and add RNCardscan.xcodeproj
  3. 3.
    In XCode, in the project navigator, select your project. Add libRNCardscan.a to your project's Build PhasesLink Binary With Libraries
  4. 4.
    Run your project Cmd+R
Android
  1. 1.
    Insert the following lines inside the dependencies block in android/app/build.gradle:
    1
    implementation project(':react-native-cardscan')
    Copied!
  2. 2.
    Append the following lines to android/settings.gradle:
    1
    include ':react-native-cardscan'
    2
    project(':react-native-cardscan').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-cardscan/android')
    Copied!
  3. 3.
    Open android/app/src/main/java/[...]/MainApplication.java
    • Add import com.getbouncer.RNCardscanPackage; to the imports at the top of the file
    • Add new RNCardscanPackage() to the list returned by the getPackages() method
Copy link