@momo-kits/qrcode 0.79.6 → 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.
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import {PixelRatio} from 'react-native';
3
+ import {RCTBarCode, RCTBarCodeProps} from './native-components/RCTBarCode';
4
+
5
+ const ratio = PixelRatio.get();
6
+
7
+ type BarCodeViewProps = Omit<RCTBarCodeProps, 'ratio'> & {
8
+ ratio?: number;
9
+ };
10
+
11
+ function BarCodeView({ratio: customRatio, ...props}: BarCodeViewProps) {
12
+ return <RCTBarCode ratio={customRatio ?? ratio} {...props} />;
13
+ }
14
+
15
+ export default BarCodeView;
package/QRCodeView.tsx ADDED
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import {PixelRatio} from 'react-native';
3
+ import {RCTQRCode, RCTQRCodeProps} from './native-components/RCTQRCode';
4
+ import {Image} from '@momo-kits/foundation';
5
+ import {ImageStyle} from 'react-native-fast-image';
6
+
7
+ const ratio = PixelRatio.get();
8
+ const ic_logo =
9
+ 'https://img.mservice.io/momo_app_v2/new_version/img/appx_image/ic_momo.png';
10
+
11
+ type QRCodeViewProps = Omit<RCTQRCodeProps, 'ratio'> & {
12
+ icon?: string;
13
+ showLogo?: boolean;
14
+ ratio?: number;
15
+ iconSize?: number;
16
+ iconStyle?: ImageStyle;
17
+ };
18
+
19
+ function QRCodeView({
20
+ showLogo = false,
21
+ ratio: customRatio,
22
+ icon = ic_logo,
23
+ iconSize = 32,
24
+ size,
25
+ iconStyle,
26
+ style,
27
+ ...rest
28
+ }: QRCodeViewProps) {
29
+ return (
30
+ <>
31
+ <RCTQRCode
32
+ ratio={customRatio ?? ratio}
33
+ size={size}
34
+ {...rest}
35
+ style={[
36
+ {
37
+ width: size,
38
+ height: size,
39
+ },
40
+ style,
41
+ ]}
42
+ />
43
+ {showLogo ? (
44
+ <Image
45
+ source={{uri: icon}}
46
+ style={[
47
+ {
48
+ width: iconSize,
49
+ height: iconSize,
50
+ position: 'absolute',
51
+ top: size / 2 - iconSize / 2,
52
+ left: size / 2 - iconSize / 2,
53
+ },
54
+ iconStyle,
55
+ ]}
56
+ />
57
+ ) : null}
58
+ </>
59
+ );
60
+ }
61
+
62
+ export default QRCodeView;
@@ -1,6 +1,4 @@
1
1
  import BarCodeView from './BarCodeView';
2
2
  import QRCodeView from './QRCodeView';
3
3
 
4
- export {
5
- BarCodeView, QRCodeView
6
- };
4
+ export {BarCodeView, QRCodeView};
@@ -0,0 +1,10 @@
1
+ import {requireNativeComponent, ViewProps} from 'react-native';
2
+
3
+ export type RCTBarCodeProps = {
4
+ code: string;
5
+ width: number;
6
+ height: number;
7
+ ratio: number;
8
+ } & ViewProps;
9
+
10
+ export const RCTBarCode = requireNativeComponent<RCTBarCodeProps>('RCTBarCode');
@@ -0,0 +1,9 @@
1
+ import {requireNativeComponent, ViewProps} from 'react-native';
2
+
3
+ export type RCTQRCodeProps = {
4
+ code: string;
5
+ size: number;
6
+ ratio: number;
7
+ } & ViewProps;
8
+
9
+ export const RCTQRCode = requireNativeComponent<RCTQRCodeProps>('RCTQRCode');
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "@momo-kits/qrcode",
3
- "version": "0.79.6",
3
+ "version": "0.89.6-rc.1",
4
4
  "private": false,
5
- "main": "index.js",
5
+ "main": "index.tsx",
6
6
  "dependencies": {},
7
7
  "peerDependencies": {
8
- "react-native": ">=0.55",
8
+ "@momo-kits/foundation": "latest",
9
9
  "prop-types": "^15.7.2",
10
10
  "react": "16.9.0",
11
- "@momo-kits/core": "latest"
11
+ "react-native": ">=0.55"
12
+ },
13
+ "devDependencies": {
14
+ "@momo-platform/versions": "4.1.11"
12
15
  },
13
- "devDependencies": {},
14
16
  "license": "MoMo"
15
- }
17
+ }
package/publish.sh CHANGED
@@ -1,29 +1,27 @@
1
1
  #!/bin/bash
2
+
3
+ # Prepare dist files
2
4
  rm -rf dist
3
5
  mkdir dist
4
-
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
13
-
14
- # #babel component to dist
15
- #babel ./dist -d dist --copy-files
16
-
17
- #copy option
18
- #cp -r ./src/ dist
19
-
20
-
21
- #npm login
22
- #publish dist to npm
6
+ rsync -r --exclude=/dist ./* dist
23
7
  cd dist
24
- npm publish --tag beta --access=public
8
+
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/information@beta version)
18
+ npm version prerelease --preid=beta
19
+ npm publish --tag beta --access=public
20
+ fi
21
+
22
+ PACKAGE_NAME=$(npm pkg get name)
23
+ NEW_PACKAGE_VERSION=$(npm pkg get version)
24
+
25
+ # Clean up
25
26
  cd ..
26
27
  rm -rf dist
27
-
28
-
29
- #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/qrcode new version release: '*"$VERSION"*' https://www.npmjs.com/package/@momo-kits/qrcode"}'
package/BarCodeView.js DELETED
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { ViewPropTypes, PixelRatio } from 'react-native';
4
- import { RCTBarCode } from '@momo-kits/core';
5
-
6
- const ratio = PixelRatio.get();
7
- function BarCodeView(props) {
8
- return (
9
- <RCTBarCode ratio={ratio} {...props} />
10
- );
11
- }
12
-
13
- BarCodeView.propTypes = {
14
- code: PropTypes.string,
15
- width: PropTypes.number,
16
- height: PropTypes.number,
17
- ratio: PropTypes.number,
18
- ...ViewPropTypes,
19
- };
20
-
21
- export default BarCodeView;
package/QRCodeView.js DELETED
@@ -1,40 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { ViewPropTypes, PixelRatio, Image } from 'react-native';
4
- import { RCTQRCode } from '@momo-kits/core';
5
-
6
- const ratio = PixelRatio.get();
7
- const ic_logo = 'https://img.mservice.io/momo_app_v2/new_version/img/appx_image/ic_momo.png';
8
-
9
- function QRCodeView(props) {
10
- const { showLogo, size = 0 } = props || {};
11
- return (
12
- <>
13
- <RCTQRCode ratio={ratio} {...props} />
14
- {showLogo
15
- ? (
16
- <Image
17
- source={{ uri: ic_logo }}
18
- style={{
19
- width: size / 6,
20
- height: size / 6,
21
- position: 'absolute',
22
- marginTop: size / 2 - size / 12,
23
- marginLeft: size / 2 - size / 12
24
- }}
25
- />
26
- ) : null}
27
- </>
28
-
29
- );
30
- }
31
-
32
- QRCodeView.propTypes = {
33
- code: PropTypes.string,
34
- size: PropTypes.number,
35
- ratio: PropTypes.number,
36
- showLogo: PropTypes.bool,
37
- ...ViewPropTypes,
38
- };
39
-
40
- export default QRCodeView;