@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.
- package/Camera.android.tsx +6 -6
- package/Camera.ios.tsx +1 -1
- package/index.tsx +4 -4
- package/package.json +2 -2
- package/publish.sh +19 -14
package/Camera.android.tsx
CHANGED
|
@@ -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 =
|
|
22
|
-
const nativeRef =
|
|
21
|
+
const Camera = forwardRef((props: any, ref) => {
|
|
22
|
+
const nativeRef = useRef();
|
|
23
23
|
|
|
24
|
-
|
|
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={(
|
|
46
|
+
onOpenCamera={() => {}}
|
|
47
47
|
{...props}
|
|
48
48
|
/>
|
|
49
49
|
);
|
package/Camera.ios.tsx
CHANGED
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
|
|
8
|
+
const Camera = Platform.OS === 'ios' ? CameraIOS : CameraAndroid;
|
|
9
9
|
|
|
10
10
|
const ThrottleEvent = 500;
|
|
11
11
|
|
|
12
|
-
const CameraKit =
|
|
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
|
-
|
|
29
|
+
useImperativeHandle<any, CameraApi>(ref, () => ({
|
|
30
30
|
capture,
|
|
31
31
|
startCamera,
|
|
32
32
|
stopCamera,
|
package/package.json
CHANGED
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
#
|
|
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`"}'
|