1.0.8 • Published 6 years ago
react-native-object-detector v1.0.8
react-native-object-detector
Getting started
$ npm install react-native-object-detector --save
Mostly automatic installation
$ react-native link react-native-object-detector
Manual installation
iOS
- Add the following to podfile
pod 'RNObjectDetector', :path => '../node_modules/react-native-object-detector/ios', :subspecs => [ 'ObjectDetector' ] - Run pod install
- Run your project (
Cmd+R)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.lts.objectdetector.RNObjectDetectorPackage;to the imports at the top of the file - Add
new RNObjectDetectorPackage()to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':react-native-object-detector' project(':react-native-object-detector').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-object-detector/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:compile project(':react-native-object-detector') - Set screen orientation to portrait in
AndroidManifest.xml:``` android:screenOrientation="portrait" ```
Usage
import ObjectDetector from 'react-native-object-detector';
<ObjectDetector
sampleImage={require('./sample.jpg')}
onObjectCaptured={this.onObjectCaptured}
detectionCountBeforeCapture={3}
overlayColor="#00FF0080"
/>