Skip to content

Commit

Permalink
Merge pull request #3 from zyunique/main
Browse files Browse the repository at this point in the history
modify
  • Loading branch information
zyunique committed Mar 30, 2021
2 parents 2516145 + c7c4753 commit fb24bd6
Show file tree
Hide file tree
Showing 13 changed files with 3,454 additions and 38 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

*.xcworkspace
*.xcscheme
*.lock
# Android/IntelliJ
#
build/
Expand Down
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,21 @@ A barcode scanner component for React Native built on top of [Dynamsoft Mobile B
- Android Studio.

## Quick Start
1. Install the barcode scanner module:
1. Find the examples/basic folder:

```bash
npm install rn-mobile-barcode-scanner
yarn(recommend) or npm install
```

2. Find the basic example located under `node_modules/rn-mobile-barcode-scanner/examples/basic`.
2. for iOS, find the examples/basic/ios, run `pod install`.
3. Build and run the demo:

```bash
npm install
npx react-native run-android
npx react-native run-ios
```

### Screenshots
### Screenshots
<kbd><img src="https://www.dynamsoft.com/codepool/img/2021/react-native-barcode-scanner.png" width="50%">

## How to Use the Barcode Scanner Module
Expand All @@ -37,9 +36,14 @@ A barcode scanner component for React Native built on top of [Dynamsoft Mobile B
```bash
react-native init NewProject
```

2. Install the latest `rn-mobile-barcode-scanner` and save it to `package.json`.

2. Mostly automatic install with autolinking (RN > 0.60)
1). `npm install react-native-camera --save`
2). Run `cd ios && pod install && cd ..`
Mostly automatic install with react-native link (RN < 0.60)
1). `npm install react-native-camera --save`
2). `react-native link react-native-camera`

3. Install the latest `rn-mobile-barcode-scanner` and save it to `package.json`.
```json
"dependencies": {
"react": "16.9.0",
Expand All @@ -48,8 +52,7 @@ A barcode scanner component for React Native built on top of [Dynamsoft Mobile B
},
```

3. Use the module in `App.js`.

4. Use the module in `App.js`.
```js
import {NativeModules} from 'react-native';
import { RNCamera } from 'rn-mobile-barcode-scanner';
Expand Down Expand Up @@ -108,4 +111,4 @@ A barcode scanner component for React Native built on top of [Dynamsoft Mobile B
You can get a [30-day FREE Trial License](https://www.dynamsoft.com/customer/license/trialLicense) online. Without a valid license, the SDK can work but only return obfuscated results.

## Contact Us
If there are any questions, please feel free to contact support@dynamsoft.com.
If there are any questions, please feel free to contact support@dynamsoft.com.
9 changes: 4 additions & 5 deletions examples/basic/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
TouchableOpacity,
Dimensions
} from 'react-native';
import { RNCamera } from 'RN-mobile-barcode-scanner';
import { RNCamera } from 'rn-mobile-barcode-scanner';
import Canvas from 'react-native-canvas';
const deviceH = Dimensions.get('window').height
const deviceW = Dimensions.get('window').width
Expand Down Expand Up @@ -70,9 +70,7 @@ class CameraScreen extends React.Component {
renderBarcodes = () => (
<React.Fragment key={this.state.barcodes.length}>
{this.state.barcodes.map((barcodes)=><Canvas style={[styles.overlay]} ref={cvs=>this.handleCanvas(cvs,barcodes)}/>)}
<View style={{alignSelf:'flex-start'}}>
<Text style={styles.textBlock}>{this.state.barcodes[0] ?'result:'+ this.state.barcodes[0].data:'result: null'}</Text>
</View>
<Text style={styles.textBlock}>{this.state.barcodes[0] ?'result:'+ this.state.barcodes[0].data:'result: null'}</Text>
</React.Fragment>
);

Expand Down Expand Up @@ -155,7 +153,8 @@ const styles = StyleSheet.create({
height: 'auto',
color: 'white',
textAlign: 'center',
padding: 10
padding: 10,
flexWrap: 'wrap'
},
overlay: {
flex: 1,
Expand Down
1 change: 0 additions & 1 deletion examples/basic/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ require_relative '../node_modules/@react-native-community/cli-platform-ios/nativ
platform :ios, '10.0'

target 'basic' do
pod 'DynamsoftBarcodeReader'
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
Expand Down
101 changes: 101 additions & 0 deletions examples/basic/ios/basic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,33 @@
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
40AEAB83445BFB68B166F1E0 /* libPods-basic.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8613E69D146E6D87B6F71D9E /* libPods-basic.a */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
C41F0DA02613137800E2197E /* libRNCamera.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C41F0CE92612F16100E2197E /* libRNCamera.a */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
C41F0CE82612F16100E2197E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = C41F0CE42612F16100E2197E /* RNCamera.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 4107012F1ACB723B00C6AA39;
remoteInfo = RNCamera;
};
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
13B07F961A680F5B00A75B9A /* basic.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = basic.app; sourceTree = BUILT_PRODUCTS_DIR; };
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = basic/AppDelegate.h; sourceTree = "<group>"; };
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = basic/AppDelegate.m; sourceTree = "<group>"; };
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = basic/Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = basic/Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = basic/main.m; sourceTree = "<group>"; };
6AFA28740C18E829FE42272B /* Pods-basic.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-basic.debug.xcconfig"; path = "Target Support Files/Pods-basic/Pods-basic.debug.xcconfig"; sourceTree = "<group>"; };
71303803E8D6D49FB7740E65 /* Pods-basic.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-basic.release.xcconfig"; path = "Target Support Files/Pods-basic/Pods-basic.release.xcconfig"; sourceTree = "<group>"; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = basic/LaunchScreen.storyboard; sourceTree = "<group>"; };
8613E69D146E6D87B6F71D9E /* libPods-basic.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-basic.a"; sourceTree = BUILT_PRODUCTS_DIR; };
C41F0CE42612F16100E2197E /* RNCamera.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNCamera.xcodeproj; path = ../../../ios/RNCamera.xcodeproj; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */

Expand All @@ -29,6 +45,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C41F0DA02613137800E2197E /* libRNCamera.a in Frameworks */,
40AEAB83445BFB68B166F1E0 /* libPods-basic.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -52,13 +70,15 @@
isa = PBXGroup;
children = (
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
8613E69D146E6D87B6F71D9E /* libPods-basic.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
C41F0CE42612F16100E2197E /* RNCamera.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
Expand All @@ -70,6 +90,7 @@
832341AE1AAA6A7D00B99B32 /* Libraries */,
83CBBA001A601CBA00E9B192 /* Products */,
2D16E6871FA4F8E400B85C8A /* Frameworks */,
F3529C167A13798ABF556C7F /* Pods */,
);
indentWidth = 2;
sourceTree = "<group>";
Expand All @@ -84,18 +105,37 @@
name = Products;
sourceTree = "<group>";
};
C41F0CE52612F16100E2197E /* Products */ = {
isa = PBXGroup;
children = (
C41F0CE92612F16100E2197E /* libRNCamera.a */,
);
name = Products;
sourceTree = "<group>";
};
F3529C167A13798ABF556C7F /* Pods */ = {
isa = PBXGroup;
children = (
6AFA28740C18E829FE42272B /* Pods-basic.debug.xcconfig */,
71303803E8D6D49FB7740E65 /* Pods-basic.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
13B07F861A680F5B00A75B9A /* basic */ = {
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "basic" */;
buildPhases = (
3585CD25C7446E225D5D10F2 /* [CP] Check Pods Manifest.lock */,
FD10A7F022414F080027D42C /* Start Packager */,
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
C87964CA5F74272D58512DDF /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -130,13 +170,29 @@
mainGroup = 83CBB9F61A601CBA00E9B192;
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = C41F0CE52612F16100E2197E /* Products */;
ProjectRef = C41F0CE42612F16100E2197E /* RNCamera.xcodeproj */;
},
);
projectRoot = "";
targets = (
13B07F861A680F5B00A75B9A /* basic */,
);
};
/* End PBXProject section */

/* Begin PBXReferenceProxy section */
C41F0CE92612F16100E2197E /* libRNCamera.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNCamera.a;
remoteRef = C41F0CE82612F16100E2197E /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */

/* Begin PBXResourcesBuildPhase section */
13B07F8E1A680F5B00A75B9A /* Resources */ = {
isa = PBXResourcesBuildPhase;
Expand Down Expand Up @@ -164,6 +220,45 @@
shellPath = /bin/sh;
shellScript = "set -e\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
};
3585CD25C7446E225D5D10F2 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-basic-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
C87964CA5F74272D58512DDF /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-basic/Pods-basic-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-basic/Pods-basic-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-basic/Pods-basic-resources.sh\"\n";
showEnvVarsInLog = 0;
};
FD10A7F022414F080027D42C /* Start Packager */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -200,11 +295,14 @@
/* Begin XCBuildConfiguration section */
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 6AFA28740C18E829FE42272B /* Pods-basic.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = W6PESGXW9M;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../../../ios/";
INFOPLIST_FILE = basic/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -225,10 +323,13 @@
};
13B07F951A680F5B00A75B9A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 71303803E8D6D49FB7740E65 /* Pods-basic.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = W6PESGXW9M;
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../../../ios/";
INFOPLIST_FILE = basic/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down
2 changes: 2 additions & 0 deletions examples/basic/ios/basic/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSCameraUsageDescription</key>
<string>DBR camera access.</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-canvas": "^0.1.37",
"RN-mobile-barcode-scanner": "file:../../",
"rn-mobile-barcode-scanner": "file:../../",
"react-native-webview": "^11.2.0"
},
"devDependencies": {
Expand Down
Binary file not shown.
Loading

0 comments on commit fb24bd6

Please sign in to comment.