react-native-sunmi-inner-scanner
所属分类:文章/文档
开发工具:Java
文件大小:0KB
下载次数:0
上传日期:2022-12-07 10:12:17
上 传 者:
sh-1993
说明: 根据[http: docs.sunmi.com htmls index.html lang=zh##V1文档资源](http: docs.sunmi.com htmls index.html lang=zh##V1%E6%96%87%E6%A1%A3%E8%B5%84%E6%BA%90) 开发的适用与react-native的商米扫码启动器。,
(Based on [http: docs.sunmi.com html index. html lang=zh # # V1 Document Resources] (http: docs.sunmi.com html index. html lang=zh # # V1% E6% 96% 87% E6% A1% A3% E8% B5% 84% E6% BA% 90), a quotient meter scanning initiator that is suitable for and reactive.,)
文件列表:
.npmignore (104, 2018-09-20)
android/ (0, 2018-09-20)
android/build.gradle (705, 2018-09-20)
android/libs/ (0, 2018-09-20)
android/libs/armeabi-v7a/ (0, 2018-09-20)
android/libs/armeabi-v7a/libiconv.so (890316, 2018-09-20)
android/libs/armeabi-v7a/libscaninit.so (13764, 2018-09-20)
android/libs/armeabi-v7a/libsunmiscan.so (103964, 2018-09-20)
android/libs/sunmiscan.jar (6062, 2018-09-20)
android/src/ (0, 2018-09-20)
android/src/main/ (0, 2018-09-20)
android/src/main/AndroidManifest.xml (270, 2018-09-20)
android/src/main/java/ (0, 2018-09-20)
android/src/main/java/com/ (0, 2018-09-20)
android/src/main/java/com/sunmi/ (0, 2018-09-20)
android/src/main/java/com/sunmi/scanner/ (0, 2018-09-20)
android/src/main/java/com/sunmi/scanner/CameraManager.java (2873, 2018-09-20)
android/src/main/java/com/sunmi/scanner/CameraPreview.java (8564, 2018-09-20)
android/src/main/java/com/sunmi/scanner/SoundUtils.java (3086, 2018-09-20)
android/src/main/java/com/sunmi/scanner/SunmiInnerScannerModule.java (4546, 2018-09-20)
android/src/main/java/com/sunmi/scanner/SunmiInnerScannerPackage.java (927, 2018-09-20)
android/src/main/java/com/sunmi/scanner/SunmiInnerScannerView.java (7320, 2018-09-20)
android/src/main/java/com/sunmi/scanner/SunmiInnerScannerViewManager.java (1685, 2018-09-20)
android/src/main/res/ (0, 2018-09-20)
android/src/main/res/raw/ (0, 2018-09-20)
android/src/main/res/raw/beep.ogg (10185, 2018-09-20)
examples/ (0, 2018-09-20)
examples/android/ (0, 2018-09-20)
examples/android/app/ (0, 2018-09-20)
examples/android/app/BUCK (1574, 2018-09-20)
examples/android/app/build.gradle (5465, 2018-09-20)
examples/android/app/proguard-rules.pro (2682, 2018-09-20)
examples/android/app/src/ (0, 2018-09-20)
examples/android/app/src/main/ (0, 2018-09-20)
examples/android/app/src/main/AndroidManifest.xml (1145, 2018-09-20)
examples/android/app/src/main/java/ (0, 2018-09-20)
examples/android/app/src/main/java/com/ (0, 2018-09-20)
examples/android/app/src/main/java/com/examples/ (0, 2018-09-20)
examples/android/app/src/main/java/com/examples/MainActivity.java (361, 2018-09-20)
... ...
# react-native-sunmi-inner-scanner
http://docs.sunmi.com/htmls/index.html?lang=zh##V1文档资源 根据商米V1文档开发打印接口
(React native plugin Referring the sunmi V1 scanner document and demos)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/januslo/react-native-sunmi-inner-scanner/master/LICENSE) [![npm version](https://badge.fury.io/js/react-native-sunmi-inner-scanner.svg)](https://www.npmjs.com/package/react-native-sunmi-inner-scanner)
_ **Caution: this is not the official project. I share it because I am working on this device but no any official support in react-native It's welcome to ask any question about the usage,problems or feature required, I will support ASAP.**_
======================================================================================
**Installation:**
Step 1. install with npm: [Checks In the NPM](https://www.npmjs.com/package/react-native-sunmi-inner-scanner)
```bash
npm i react-native-sunmi-inner-scanner --save
```
or you may need to install via the clone address directly:
```bash
npm install https://github.com/januslo/react-native-sunmi-inner-scanner.git --save
```
Step 2:
Links this plugin to your project.
```bash
react-native link react-native-sunmi-inner-scanner
```
or you may need to link manually
* modify settings.gradle
```javascript
include ':react-native-sunmi-inner-scanner'
project(':react-native-sunmi-inner-scanner').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sunmi-inner-scanner/android')
```
* modify app/build.gradle,add dependenceie:
```javascript
compile project(':react-native-sunmi-inner-scanner')
```
* adds package references to MainPackage.java
```java
import com.sunmi.scanner.SunmiInnerScannerPackage;
...
@Override
protected List getPackages() {
return Arrays.asList(
new MainReactPackage(),
new SunmiInnerScannerPackage()
);
}
```
Step 3: refer in the javascript:
*Using the default inner scanner:
```javascript
import SunmiInnerScanner from 'react-native-sunmi-inner-scanner';
```
*Customer your preview with the SunmiScannerView
```javascript
import {SunmiScannerView} from 'react-native-sunmi-inner-scanner';
```
**Usage:**
You may need to refer the excamples from the 'examples' folder of the source code.
*Using SunmiInnerScanner
you can open the scanner with default options:
```javascript
async _openDefaultScanner(){
let result = await SunmiInnerScanner.openScanner();
this.setState({result: JSON.stringify(result)}
,()=>{
console.log(this.state.result);
});
}
```
or you can specify the options:
```javascript
async _openScannerWithOptions(){
let options={
showSetting:true,
showAlbum:true,
paySound:true,
payVibrate:true,// V1 not support
}
let result = await SunmiInnerScanner.openScannerWithOptions(options);
this.setState({result: JSON.stringify(result)}
,()=>{
console.log(this.state.result);
});
}
```
*Using SunmiScannerView
```javascript
render() {
return
Scan Result: {this.state.result}
{
this.setState({
result:JSON.stringify(data)
})
}
}>
}
```
providing the properties definition for referring:
```javascript
static propTypes = {
...View.propTypes,
xDensity: PropTypes.oneOfType([
PropTypes.number
]),
yDensity: PropTypes.oneOfType([
PropTypes.number
]),
mutilScanEnable: PropTypes.oneOfType([
PropTypes.number
]),
inverseEnable: PropTypes.oneOfType([
PropTypes.number
]),
onCodeScan: React.PropTypes.func
};
static defaultProps = {
xDensity: 2,
yDensity: 2,
mutilScanEnable: 0,
inverseEnable: 1,
onCodeScan: function (result) {
console.log(result);
},
scanInterval:1000, // interval of scan operation after last record was recongized.
mute:0 // mute the "bee" sound on success. 1 - mute;0 - not mute
}
```
近期下载者:
相关文件:
收藏者: