Download the plugin via npm
$ npm install cmbsdk-react-native --save
Mostly automatic installation
$ react-native link cmbsdk-react-native
Import the component in your react-native app by adding this
import { CMBReader, cmbComponent } from 'cmbsdk-react-native';
You can access all of the API methods through cmbComponent constant, and all of the enums and constants are available in the CMBReader class.
Before continuing, download the cmbSDK React-Native zip file from our download section, and see the API reference.
Download page: https://cmbdn.cognex.com/download
API reference: https://www.npmjs.com/package/cmbsdk-react-native
Make sure you have downloaded the cmbSDK React-Native zip archive from our download page. From the downloaded zip file, open the iOS directory.
1. If you are using the mobile device's built in camera, do the same with the "MWBScannerImages.xcassets" file located in the iOS/Resources directory.
2. In your projects info.plist file you need to add a key depending on the readerDevice type that you are using.
And that's it. You should be able to run your app with the cmbSDK react-native module working.
Make sure you have downloaded the cmbSDK React-Native zip archive from our download page. From the downloaded zip file, open the Android/cmbsdk-android-binary directory.
1. Open the yourRNApp/android/app/ directory, create a new folder named "libs" if there isn't one already, and open it. Place the file "cmbsdklib-release.aar" inside the libs folder. This aar can be found in "Android/cmbsdk-android-binary" from the downloaded zip file
2. Open the app build.gradle located in yourRNApp/android/app and add these lines:
- Above the dependencies add this:
repositories {
flatDir {
dirs 'libs'
}
}
3. Open the build.gradle located in yourRNApp/android and change the minSdkVersion to 19 or above
And that's it. You should be able to run your app with the cmbSDK react-native module working.