@momo-kits/camerakit 0.89.5 → 0.89.6-rc.1

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.
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, {forwardRef, useImperativeHandle, useRef} from 'react';
2
2
 
3
3
  import {
4
4
  findNodeHandle,
@@ -18,14 +18,14 @@ if (NativeModules?.RNCameraKitModule) {
18
18
  NativeCamera = requireNativeComponent('CKCameraManager');
19
19
  }
20
20
 
21
- const Camera = React.forwardRef((props: any, ref) => {
22
- const nativeRef = React.useRef();
21
+ const Camera = forwardRef((props: any, ref) => {
22
+ const nativeRef = useRef();
23
23
 
24
- React.useImperativeHandle<any, CameraApi>(ref, () => ({
24
+ useImperativeHandle<any, CameraApi>(ref, () => ({
25
25
  capture: async (options = {}) => {
26
26
  return await Module.capture(
27
27
  options,
28
- findNodeHandle(nativeRef.current ?? null),
28
+ findNodeHandle(nativeRef.current ?? null)
29
29
  );
30
30
  },
31
31
  startCamera: () => {
@@ -43,7 +43,7 @@ const Camera = React.forwardRef((props: any, ref) => {
43
43
  <NativeCamera
44
44
  style={{minWidth: 100, minHeight: 100}}
45
45
  ref={nativeRef}
46
- onOpenCamera={(event: any) => {}}
46
+ onOpenCamera={() => {}}
47
47
  {...props}
48
48
  />
49
49
  );
package/Camera.ios.tsx CHANGED
@@ -24,7 +24,7 @@ const Camera = React.forwardRef((props: any, ref: any) => {
24
24
  return (
25
25
  <NativeCamera
26
26
  style={{minWidth: 100, minHeight: 100}}
27
- onOpenCamera={(event: any) => {}}
27
+ onOpenCamera={() => {}}
28
28
  {...props}
29
29
  />
30
30
  );
package/index.tsx CHANGED
@@ -1,15 +1,15 @@
1
- import React, {useRef} from 'react';
1
+ import React, {forwardRef, useImperativeHandle, useRef} from 'react';
2
2
  import {Platform, StyleSheet, View} from 'react-native';
3
3
  import styles from './styles';
4
4
  import CameraIOS from './Camera.ios';
5
5
  import CameraAndroid from './Camera.android';
6
6
  import {CameraApi, CameraKitProps} from './type';
7
7
 
8
- const Camera = Platform.OS == 'ios' ? CameraIOS : CameraAndroid;
8
+ const Camera = Platform.OS === 'ios' ? CameraIOS : CameraAndroid;
9
9
 
10
10
  const ThrottleEvent = 500;
11
11
 
12
- const CameraKit = React.forwardRef(
12
+ const CameraKit = forwardRef(
13
13
  (
14
14
  {
15
15
  onBarCodeRead,
@@ -26,7 +26,7 @@ const CameraKit = React.forwardRef(
26
26
  const lastEvent = useRef<any>(null);
27
27
  const lastTime = useRef<number>(0);
28
28
 
29
- React.useImperativeHandle<any, CameraApi>(ref, () => ({
29
+ useImperativeHandle<any, CameraApi>(ref, () => ({
30
30
  capture,
31
31
  startCamera,
32
32
  stopCamera,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/camerakit",
3
- "version": "0.89.5",
3
+ "version": "0.89.6-rc.1",
4
4
  "private": false,
5
5
  "main": "index.tsx",
6
6
  "peerDependencies": {
@@ -13,4 +13,4 @@
13
13
  },
14
14
  "license": "MoMo",
15
15
  "dependencies": {}
16
- }
16
+ }
package/publish.sh CHANGED
@@ -1,22 +1,27 @@
1
1
  #!/bin/bash
2
+
3
+ # Prepare dist files
2
4
  rm -rf dist
3
5
  mkdir dist
6
+ rsync -r --exclude=/dist ./* dist
7
+ cd dist
4
8
 
5
- cp . ./dist
6
-
7
- # GET VERSION from mck_package.json
8
- VERSIONSTRING=( v$(jq .version package.json) )
9
- VERSION=(${VERSIONSTRING//[\"]/})
10
- echo VERSION: $VERSION
11
-
12
- rsync -r --verbose --exclude '*.mdx' --exclude '*Demo.js' --exclude 'props-type.js' --exclude 'prop-types.js' ./* dist
9
+ if [ "$1" == "stable" ]; then
10
+ npm version $(npm view @momo-kits/foundation@stable version)
11
+ npm version patch
12
+ npm publish --tag stable --access=public
13
+ elif [ "$1" == "latest" ]; then
14
+ npm version $(npm view @momo-kits/foundation@latest version)
15
+ npm publish --tag latest --access=public
16
+ else
17
+ npm version $(npm view @momo-kits/camerakit@beta version)
18
+ npm version prerelease --preid=beta
19
+ npm publish --tag beta --access=public
20
+ fi
13
21
 
22
+ PACKAGE_NAME=$(npm pkg get name)
23
+ NEW_PACKAGE_VERSION=$(npm pkg get version)
14
24
 
15
- #npm login
16
- #publish dist to npm
17
- cd dist
18
- npm publish --tag beta --access=public
25
+ # Clean up
19
26
  cd ..
20
27
  rm -rf dist
21
-
22
- ##curl -X POST -H 'Content-Type: application/json' 'https://chat.googleapis.com/v1/spaces/AAAAbP8987c/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=UGSFRvk_oYb9uGsAgs31bVvMm6jDkmD8zihGm3eyaQA%3D&threadKey=JoaXTEYaNNkl' -d '{"text": "@momo-kits/bank new version release: '*"$VERSION"*' `https://www.npmjs.com/package/@momo-kits/avatar`"}'