react-native-roxit-code-scanner 0.1.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,25 +6,26 @@ Broadcast code scanner receiver
6
6
 
7
7
  ```sh
8
8
  npm install react-native-roxit-code-scanner
9
+ yarn add react-native-roxit-code-scanner
9
10
  ```
10
11
 
11
12
  ## Usage
12
13
 
13
14
  ```js
14
- import * as ScodeScanner from 'react-native-roxit-code-scanner';
15
+ import * as BarcodeScanner from 'react-native-roxit-code-scanner';
15
16
  import {DeviceEventEmitter} from "react-native";
16
17
 
17
18
  // ...
18
19
 
19
- const scode_callback = useCallback(scode => {
20
- console.log('scode', scode);
20
+ const barcode_callback = useCallback(barcode => {
21
+ console.log('barcode', barcode);
21
22
  }, []);
22
23
 
23
24
  useEffect(
24
25
  () => {
25
26
  setTimeout(() => {
26
- DeviceEventEmitter.addListener('scode', scode_callback);
27
- return () => DeviceEventEmitter.removeAllListeners('scode');
27
+ DeviceEventEmitter.addListener('barcode', barcode_callback);
28
+ return () => DeviceEventEmitter.removeAllListeners('barcode');
28
29
  }, 100);
29
30
  }
30
31
  );
@@ -16,7 +16,7 @@ public class RoxitCodeScannerModule extends ReactContextBaseJavaModule {
16
16
  this.reactContext = reactContext;
17
17
  reactContext.registerReceiver(new ScannerReceiver(), new IntentFilter("com.xcheng.scanner.action.BARCODE_DECODING_BROADCAST"));
18
18
  reactContext.registerReceiver(new ScannerReceiver(), new IntentFilter("android.intent.ACTION_DECODE_DATA"));
19
- reactContext.registerReceiver(new ScannerReceiver(), new IntentFilter("scode"));
19
+ reactContext.registerReceiver(new ScannerReceiver(), new IntentFilter("barcode"));
20
20
  }
21
21
 
22
22
  @Override
@@ -26,32 +26,32 @@ public class ScannerReceiver extends BroadcastReceiver {
26
26
  // Bundle bundle = new Bundle();
27
27
  ReactApplication rnApp = (ReactApplication) context.getApplicationContext();
28
28
  if (intent.getAction().equals("com.xcheng.scanner.action.BARCODE_DECODING_BROADCAST")) {
29
- // bundle.putString("scode", intent.getStringExtra(Intent.EXTRA_TEXT));
29
+ // bundle.putString("barcode", intent.getStringExtra(Intent.EXTRA_TEXT));
30
30
  // Toast.makeText(context, intent.getStringExtra("EXTRA_BARCODE_DECODING_DATA"), 2000).show();
31
31
  rnApp.getReactNativeHost().getReactInstanceManager()
32
32
  .getCurrentReactContext()
33
33
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
34
- .emit("scode", intent.getStringExtra("EXTRA_BARCODE_DECODING_DATA"));
34
+ .emit("barcode", intent.getStringExtra("EXTRA_BARCODE_DECODING_DATA"));
35
35
  }
36
36
  if (intent.getAction().equals("android.intent.ACTION_DECODE_DATA")) {
37
37
  rnApp.getReactNativeHost().getReactInstanceManager()
38
38
  .getCurrentReactContext()
39
39
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
40
- .emit("scode", intent.getStringExtra("barcode_string"));
40
+ .emit("barcode", intent.getStringExtra("barcode_string"));
41
41
  }
42
- if (intent.getAction().equals("scode")) {
42
+ if (intent.getAction().equals("barcode")) {
43
43
  rnApp.getReactNativeHost().getReactInstanceManager()
44
44
  .getCurrentReactContext()
45
45
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
46
- .emit("scode", intent.getStringExtra("scode"));
46
+ .emit("barcode", intent.getStringExtra("barcode"));
47
47
  }
48
48
  }
49
49
  }
50
50
 
51
- // public void sendCallEvent(String scode){
51
+ // public void sendCallEvent(String barcode){
52
52
  // WritableMap params = Arguments.createMap();
53
- // params.putString("scode", scode);
54
- // sendEvent("ScodeRecevied", params);
53
+ // params.putString("barcode", barcode);
54
+ // sendEvent("BarcodeRecevied", params);
55
55
  // }
56
56
  //
57
57
  // private void sendEvent(String eventName, @Nullable WritableMap params) {
package/lefthook.yml ADDED
@@ -0,0 +1,34 @@
1
+ # EXAMPLE USAGE
2
+ # Refer for explanation to following link:
3
+ # https://github.com/evilmartians/lefthook/blob/master/docs/full_guide.md
4
+ #
5
+ # pre-push:
6
+ # commands:
7
+ # packages-audit:
8
+ # tags: frontend security
9
+ # run: yarn audit
10
+ # gems-audit:
11
+ # tags: backend security
12
+ # run: bundle audit
13
+ #
14
+ # pre-commit:
15
+ # parallel: true
16
+ # commands:
17
+ # eslint:
18
+ # glob: "*.{js,ts}"
19
+ # run: yarn eslint {staged_files}
20
+ # rubocop:
21
+ # tags: backend style
22
+ # glob: "*.rb"
23
+ # exclude: "application.rb|routes.rb"
24
+ # run: bundle exec rubocop --force-exclusion {all_files}
25
+ # govet:
26
+ # tags: backend style
27
+ # files: git ls-files -m
28
+ # glob: "*.go"
29
+ # run: go vet {files}
30
+ # scripts:
31
+ # "hello.js":
32
+ # runner: node
33
+ # "any.go":
34
+ # runner: go run
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "react-native-roxit-code-scanner",
3
- "version": "0.1.3",
4
- "description": "test",
3
+ "version": "1.0.0",
4
+ "description": "Broadcast code scanner receiver",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "jest"
8
8
  },
9
9
  "keywords": [
10
+ "barcode",
11
+ "scanner",
10
12
  "react-native",
11
13
  "android"
12
14
  ],
@@ -23,16 +25,5 @@
23
25
  "publishConfig": {
24
26
  "registry": "https://registry.npmjs.org/"
25
27
  },
26
- "resolutions": {
27
- "@types/react": "17.0.21"
28
- },
29
- "peerDependencies": {
30
- "react": "*",
31
- "react-native": "*"
32
- },
33
- "directories": {
34
- "example": "example",
35
- "lib": "lib"
36
- },
37
28
  "devDependencies": {}
38
29
  }