@momo-kits/qrcode 0.150.2-beta.5 → 0.150.2-beta.8
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/android/src/main/java/com/momokits/qrcode/MomoBarCodeViewManager.kt +5 -13
- package/android/src/main/java/com/momokits/qrcode/MomoQrCodeViewManager.kt +9 -16
- package/ios/RCTBarCode.mm +31 -12
- package/ios/RCTQRCode.mm +25 -11
- package/lib/module/BarCodeView.js +15 -3
- package/lib/module/BarCodeView.js.map +1 -1
- package/lib/module/QRCodeView.js +10 -5
- package/lib/module/QRCodeView.js.map +1 -1
- package/lib/module/RCTBarCodeNativeComponent.ts +6 -6
- package/lib/module/RCTQRCodeNativeComponent.ts +5 -3
- package/lib/typescript/src/BarCodeView.d.ts +9 -1
- package/lib/typescript/src/BarCodeView.d.ts.map +1 -1
- package/lib/typescript/src/QRCodeView.d.ts +13 -3
- package/lib/typescript/src/QRCodeView.d.ts.map +1 -1
- package/lib/typescript/src/RCTBarCodeNativeComponent.d.ts +6 -5
- package/lib/typescript/src/RCTBarCodeNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/RCTQRCodeNativeComponent.d.ts +5 -1
- package/lib/typescript/src/RCTQRCodeNativeComponent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/BarCodeView.tsx +33 -3
- package/src/QRCodeView.tsx +23 -7
- package/src/RCTBarCodeNativeComponent.ts +6 -6
- package/src/RCTQRCodeNativeComponent.ts +5 -3
- package/ios/RCTBarCodeManager.mm +0 -15
- package/ios/RCTQRCodeManager.mm +0 -15
|
@@ -2,8 +2,6 @@ package com.momokits.qrcode
|
|
|
2
2
|
|
|
3
3
|
// MomoBarCodeViewManager.kt
|
|
4
4
|
|
|
5
|
-
//package com.qrcode
|
|
6
|
-
|
|
7
5
|
import android.graphics.Bitmap
|
|
8
6
|
import android.os.Build
|
|
9
7
|
import android.widget.ImageView
|
|
@@ -69,22 +67,24 @@ class MomoBarCodeViewManager :
|
|
|
69
67
|
|
|
70
68
|
@ReactProp(name = "ratio")
|
|
71
69
|
override fun setRatio(view: ImageView, value: Float) {
|
|
72
|
-
this.ratio =
|
|
70
|
+
this.ratio = value.toDouble() // Fix: use value instead of ratio
|
|
73
71
|
parseToBarCode(view)
|
|
74
72
|
}
|
|
75
73
|
|
|
76
74
|
@ReactProp(name = "width")
|
|
77
75
|
override fun setWidth(view: ImageView, width: Int) {
|
|
78
|
-
this.width = width
|
|
76
|
+
this.width = if (width > 0) width else 0 // Fix: check for positive value
|
|
79
77
|
parseToBarCode(view)
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
@ReactProp(name = "height")
|
|
83
81
|
override fun setHeight(view: ImageView, height: Int) {
|
|
84
|
-
this.height = height
|
|
82
|
+
this.height = if (height > 0) height else 0 // Fix: check for positive value
|
|
85
83
|
parseToBarCode(view)
|
|
86
84
|
}
|
|
87
85
|
|
|
86
|
+
override fun getDelegate(): ViewManagerDelegate<ImageView>? = delegate
|
|
87
|
+
|
|
88
88
|
private fun parseToBarCode(imageView: ImageView) {
|
|
89
89
|
val text = code
|
|
90
90
|
if (!text.isNullOrEmpty() && width > 0 && height > 0) {
|
|
@@ -99,13 +99,5 @@ class MomoBarCodeViewManager :
|
|
|
99
99
|
e.printStackTrace()
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
scaleToFitImage(imageView)
|
|
103
102
|
}
|
|
104
|
-
|
|
105
|
-
// Fabric requires you to expose the delegate:
|
|
106
|
-
override fun getDelegate(): ViewManagerDelegate<ImageView>? =
|
|
107
|
-
delegate
|
|
108
|
-
|
|
109
103
|
}
|
|
110
|
-
|
|
111
|
-
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
package com.momokits.qrcode
|
|
4
4
|
|
|
5
|
-
import android.R.attr.bitmap
|
|
6
5
|
import android.graphics.Bitmap
|
|
7
6
|
import android.widget.ImageView
|
|
8
7
|
import androidx.annotation.Nullable
|
|
@@ -16,9 +15,7 @@ import com.google.zxing.BarcodeFormat
|
|
|
16
15
|
import com.google.zxing.EncodeHintType
|
|
17
16
|
import com.google.zxing.WriterException
|
|
18
17
|
import com.google.zxing.common.BitMatrix
|
|
19
|
-
import com.google.zxing.oned.Code128Writer
|
|
20
18
|
import com.google.zxing.qrcode.QRCodeWriter
|
|
21
|
-
import kotlin.math.floor
|
|
22
19
|
|
|
23
20
|
|
|
24
21
|
class MomoQrCodeViewManager :
|
|
@@ -29,10 +26,6 @@ class MomoQrCodeViewManager :
|
|
|
29
26
|
private var size: Int = 200
|
|
30
27
|
private var ratio: Double = 1.0
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
private val hintMap = HashMap<EncodeHintType, Any>()
|
|
34
|
-
private val code128Writer = Code128Writer()
|
|
35
|
-
|
|
36
29
|
companion object {
|
|
37
30
|
const val REACT_CLASS = "RCTQRCode"
|
|
38
31
|
}
|
|
@@ -42,8 +35,12 @@ class MomoQrCodeViewManager :
|
|
|
42
35
|
|
|
43
36
|
override fun getName() = REACT_CLASS
|
|
44
37
|
|
|
45
|
-
override fun createViewInstance(ctx: ThemedReactContext)
|
|
46
|
-
ImageView(ctx)
|
|
38
|
+
override fun createViewInstance(ctx: ThemedReactContext): ImageView {
|
|
39
|
+
val imageView = ImageView(ctx)
|
|
40
|
+
imageView.adjustViewBounds = true
|
|
41
|
+
imageView.scaleType = ImageView.ScaleType.FIT_CENTER
|
|
42
|
+
return imageView
|
|
43
|
+
}
|
|
47
44
|
|
|
48
45
|
@ReactProp(name = "code")
|
|
49
46
|
override fun setCode(view: ImageView, @Nullable code: String?) {
|
|
@@ -53,19 +50,17 @@ class MomoQrCodeViewManager :
|
|
|
53
50
|
|
|
54
51
|
@ReactProp(name = "ratio")
|
|
55
52
|
override fun setRatio(view: ImageView, value: Float) {
|
|
56
|
-
this.ratio =
|
|
53
|
+
this.ratio = value.toDouble() // Fix: use value instead of ratio
|
|
57
54
|
parseToQRCode(view)
|
|
58
55
|
}
|
|
59
56
|
|
|
60
57
|
@ReactProp(name = "size")
|
|
61
58
|
override fun setSize(view: ImageView, size: Int) {
|
|
62
|
-
this.size = size
|
|
59
|
+
this.size = if (size > 0) size else 200 // Fix: check for positive value
|
|
63
60
|
parseToQRCode(view)
|
|
64
61
|
}
|
|
65
62
|
|
|
66
|
-
override fun getDelegate(): ViewManagerDelegate<ImageView>? =
|
|
67
|
-
delegate
|
|
68
|
-
|
|
63
|
+
override fun getDelegate(): ViewManagerDelegate<ImageView>? = delegate
|
|
69
64
|
|
|
70
65
|
private fun parseToQRCode(imageView: ImageView) {
|
|
71
66
|
val text = code
|
|
@@ -85,8 +80,6 @@ class MomoQrCodeViewManager :
|
|
|
85
80
|
hintMap
|
|
86
81
|
)
|
|
87
82
|
val bitmap: Bitmap = MomoQrCodeUtils.createBitmap(bitMatrix, adjustedSize, adjustedSize)
|
|
88
|
-
imageView.adjustViewBounds = true
|
|
89
|
-
imageView.scaleType = ImageView.ScaleType.FIT_CENTER
|
|
90
83
|
imageView.setImageBitmap(bitmap)
|
|
91
84
|
} catch (e: WriterException) {
|
|
92
85
|
e.printStackTrace()
|
package/ios/RCTBarCode.mm
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
// RCTBarCode.mm
|
|
2
2
|
|
|
3
3
|
#import "RCTBarCode.h"
|
|
4
|
+
|
|
5
|
+
#import <React/RCTConversions.h>
|
|
6
|
+
#import <React/RCTConvert.h>
|
|
4
7
|
#import <react/renderer/components/QrcodeViewSpec/ComponentDescriptors.h>
|
|
5
8
|
#import <react/renderer/components/QrcodeViewSpec/Props.h>
|
|
6
9
|
#import <react/renderer/components/QrcodeViewSpec/RCTComponentViewHelpers.h>
|
|
10
|
+
#import <react/renderer/components/QrcodeViewSpec/EventEmitters.h>
|
|
7
11
|
#import "BarCodeView.h"
|
|
8
12
|
|
|
9
13
|
#import "RCTFabricComponentsPlugins.h"
|
|
@@ -17,9 +21,12 @@ using namespace facebook::react;
|
|
|
17
21
|
BarCodeView *_barcodeView;
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
- (instancetype)
|
|
24
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
21
25
|
{
|
|
22
|
-
if (self = [super
|
|
26
|
+
if (self = [super initWithFrame:frame]) {
|
|
27
|
+
static const auto defaultProps = std::make_shared<const RCTBarCodeProps>();
|
|
28
|
+
_props = defaultProps;
|
|
29
|
+
|
|
23
30
|
_barcodeView = [BarCodeView new];
|
|
24
31
|
[self addSubview:_barcodeView];
|
|
25
32
|
}
|
|
@@ -29,18 +36,30 @@ using namespace facebook::react;
|
|
|
29
36
|
- (void)updateProps:(Props::Shared const &)props
|
|
30
37
|
oldProps:(Props::Shared const &)oldProps
|
|
31
38
|
{
|
|
32
|
-
const auto &
|
|
33
|
-
|
|
39
|
+
const auto &oldViewProps = *std::static_pointer_cast<RCTBarCodeProps const>(_props);
|
|
40
|
+
const auto &newViewProps = *std::static_pointer_cast<RCTBarCodeProps const>(props);
|
|
41
|
+
|
|
42
|
+
// Apply to your view only if props changed
|
|
43
|
+
if (oldViewProps.code != newViewProps.code) {
|
|
44
|
+
if (!newViewProps.code.empty()) {
|
|
45
|
+
NSString *nsCode = [NSString stringWithUTF8String:newViewProps.code.c_str()];
|
|
46
|
+
_barcodeView.code = nsCode;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (oldViewProps.ratio != newViewProps.ratio) {
|
|
51
|
+
_barcodeView.ratio = newViewProps.ratio;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (oldViewProps.width != newViewProps.width) {
|
|
55
|
+
_barcodeView.width = newViewProps.width;
|
|
56
|
+
}
|
|
34
57
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
NSString *nsCode = [NSString stringWithUTF8String:barProps.code.c_str()];
|
|
38
|
-
_barcodeView.code = nsCode;
|
|
58
|
+
if (oldViewProps.height != newViewProps.height) {
|
|
59
|
+
_barcodeView.height = newViewProps.height;
|
|
39
60
|
}
|
|
40
|
-
_barcodeView.ratio = barProps.ratio;
|
|
41
|
-
_barcodeView.width = barProps.width;
|
|
42
|
-
_barcodeView.height = barProps.height;
|
|
43
61
|
|
|
62
|
+
_props = std::static_pointer_cast<RCTBarCodeProps const>(props);
|
|
44
63
|
[super updateProps:props oldProps:oldProps];
|
|
45
64
|
}
|
|
46
65
|
|
|
@@ -57,7 +76,7 @@ using namespace facebook::react;
|
|
|
57
76
|
|
|
58
77
|
@end
|
|
59
78
|
|
|
60
|
-
Class<
|
|
79
|
+
Class<RCTComponentViewProtocol> RCTBarCodeCls(void)
|
|
61
80
|
{
|
|
62
81
|
return RCTBarCode.class;
|
|
63
82
|
}
|
package/ios/RCTQRCode.mm
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#import "RCTQRCode.h"
|
|
2
|
+
|
|
3
|
+
#import <React/RCTConversions.h>
|
|
4
|
+
#import <React/RCTConvert.h>
|
|
2
5
|
#import <react/renderer/components/QrcodeViewSpec/ComponentDescriptors.h>
|
|
3
6
|
#import <react/renderer/components/QrcodeViewSpec/Props.h>
|
|
4
7
|
#import <react/renderer/components/QrcodeViewSpec/RCTComponentViewHelpers.h>
|
|
@@ -17,9 +20,12 @@ using namespace facebook::react;
|
|
|
17
20
|
QRCodeView *_qrView;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
- (instancetype)
|
|
23
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
21
24
|
{
|
|
22
|
-
if (self = [super
|
|
25
|
+
if (self = [super initWithFrame:frame]) {
|
|
26
|
+
static const auto defaultProps = std::make_shared<const RCTQRCodeProps>();
|
|
27
|
+
_props = defaultProps;
|
|
28
|
+
|
|
23
29
|
// Create and embed your existing UIImageView-based QRCodeView
|
|
24
30
|
_qrView = [QRCodeView new];
|
|
25
31
|
[self addSubview:_qrView];
|
|
@@ -30,18 +36,26 @@ using namespace facebook::react;
|
|
|
30
36
|
- (void)updateProps:(Props::Shared const &)props
|
|
31
37
|
oldProps:(Props::Shared const &)oldProps
|
|
32
38
|
{
|
|
33
|
-
|
|
34
|
-
const auto &
|
|
39
|
+
const auto &oldViewProps = *std::static_pointer_cast<RCTQRCodeProps const>(_props);
|
|
40
|
+
const auto &newViewProps = *std::static_pointer_cast<RCTQRCodeProps const>(props);
|
|
35
41
|
|
|
36
|
-
// Apply to your view
|
|
37
|
-
if (
|
|
38
|
-
|
|
42
|
+
// Apply to your view only if props changed
|
|
43
|
+
if (oldViewProps.code != newViewProps.code) {
|
|
44
|
+
if (!newViewProps.code.empty()) {
|
|
45
|
+
NSString *nsCode = [NSString stringWithUTF8String:newViewProps.code.c_str()];
|
|
39
46
|
_qrView.code = nsCode;
|
|
40
47
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (oldViewProps.ratio != newViewProps.ratio) {
|
|
51
|
+
_qrView.ratio = newViewProps.ratio;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (oldViewProps.size != newViewProps.size) {
|
|
55
|
+
_qrView.size = newViewProps.size;
|
|
56
|
+
}
|
|
44
57
|
|
|
58
|
+
_props = std::static_pointer_cast<RCTQRCodeProps const>(props);
|
|
45
59
|
[super updateProps:props oldProps:oldProps];
|
|
46
60
|
}
|
|
47
61
|
|
|
@@ -60,7 +74,7 @@ using namespace facebook::react;
|
|
|
60
74
|
|
|
61
75
|
@end
|
|
62
76
|
|
|
63
|
-
Class<
|
|
77
|
+
Class<RCTComponentViewProtocol> RCTQRCodeCls(void)
|
|
64
78
|
{
|
|
65
79
|
return RCTQRCode.class;
|
|
66
80
|
}
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import { PixelRatio } from 'react-native';
|
|
5
|
+
import RCTBarCode from './RCTBarCodeNativeComponent';
|
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
const BarCodeView = ({
|
|
8
|
+
code,
|
|
9
|
+
width,
|
|
10
|
+
height,
|
|
7
11
|
ratio,
|
|
8
|
-
|
|
12
|
+
style,
|
|
13
|
+
...rest
|
|
9
14
|
}) => {
|
|
10
15
|
return /*#__PURE__*/_jsx(RCTBarCode, {
|
|
16
|
+
code: code,
|
|
17
|
+
width: width,
|
|
18
|
+
height: height,
|
|
11
19
|
ratio: ratio ?? PixelRatio.get(),
|
|
12
|
-
|
|
20
|
+
style: [{
|
|
21
|
+
width,
|
|
22
|
+
height
|
|
23
|
+
}, style],
|
|
24
|
+
...rest
|
|
13
25
|
});
|
|
14
26
|
};
|
|
15
27
|
export default BarCodeView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["React","PixelRatio","RCTBarCode","jsx","_jsx","BarCodeView","code","width","height","ratio","style","rest","get"],"sourceRoot":"../../src","sources":["BarCodeView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,cAAc;AACzC,OAAOC,UAAU,MAAM,6BAA6B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAiBrD,MAAMC,WAAuC,GAAGA,CAAC;EAC/CC,IAAI;EACJC,KAAK;EACLC,MAAM;EACNC,KAAK;EACLC,KAAK;EACL,GAAGC;AACL,CAAC,KAAK;EACJ,oBACEP,IAAA,CAACF,UAAU;IACTI,IAAI,EAAEA,IAAK;IACXC,KAAK,EAAEA,KAAM;IACbC,MAAM,EAAEA,MAAO;IACfC,KAAK,EAAEA,KAAK,IAAIR,UAAU,CAACW,GAAG,CAAC,CAAE;IACjCF,KAAK,EAAE,CACL;MACEH,KAAK;MACLC;IACF,CAAC,EACDE,KAAK,CACL;IAAA,GACEC;EAAI,CACT,CAAC;AAEN,CAAC;AAED,eAAeN,WAAW","ignoreList":[]}
|
package/lib/module/QRCodeView.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Image, PixelRatio, StyleSheet } from 'react-native';
|
|
4
5
|
import RCTQRCode from './RCTQRCodeNativeComponent';
|
|
5
6
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
7
|
const ratio = PixelRatio.get();
|
|
@@ -26,17 +27,21 @@ const QRCodeView = ({
|
|
|
26
27
|
width: size,
|
|
27
28
|
height: size
|
|
28
29
|
}, style]
|
|
29
|
-
}), showLogo ? /*#__PURE__*/_jsx(Image, {
|
|
30
|
+
}), showLogo && icon ? /*#__PURE__*/_jsx(Image, {
|
|
30
31
|
source: {
|
|
31
32
|
uri: icon
|
|
32
33
|
},
|
|
33
|
-
style: [{
|
|
34
|
+
style: [styles.logoOverlay, {
|
|
34
35
|
width: iconSize,
|
|
35
|
-
height: iconSize
|
|
36
|
-
position: 'absolute'
|
|
36
|
+
height: iconSize
|
|
37
37
|
}, iconStyle]
|
|
38
38
|
}) : null]
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
|
+
const styles = StyleSheet.create({
|
|
42
|
+
logoOverlay: {
|
|
43
|
+
position: 'absolute'
|
|
44
|
+
}
|
|
45
|
+
});
|
|
41
46
|
export default QRCodeView;
|
|
42
47
|
//# sourceMappingURL=QRCodeView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Image","PixelRatio","RCTQRCode","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ratio","get","ic_logo","QRCodeView","code","showLogo","customRatio","icon","iconSize","size","iconStyle","style","rest","children","width","height","source","uri","position"],"sourceRoot":"../../src","sources":["QRCodeView.tsx"],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"names":["React","Image","PixelRatio","StyleSheet","RCTQRCode","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ratio","get","ic_logo","QRCodeView","code","showLogo","customRatio","icon","iconSize","size","iconStyle","style","rest","children","width","height","source","uri","styles","logoOverlay","create","position"],"sourceRoot":"../../src","sources":["QRCodeView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,EAAEC,UAAU,EAAEC,UAAU,QAAQ,cAAc;AAC5D,OAAOC,SAAS,MAAM,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAInD,MAAMC,KAAK,GAAGT,UAAU,CAACU,GAAG,CAAC,CAAC;AAC9B,MAAMC,OAAO,GACX,4EAA4E;AAqB9E,MAAMC,UAAqC,GAAGA,CAAC;EAC7CC,IAAI;EACJC,QAAQ,GAAG,KAAK;EAChBL,KAAK,EAAEM,WAAW;EAClBC,IAAI,GAAGL,OAAO;EACdM,QAAQ,GAAG,EAAE;EACbC,IAAI;EACJC,SAAS;EACTC,KAAK;EACL,GAAGC;AACL,CAAC,KAAK;EACJ,oBACEb,KAAA,CAAAF,SAAA;IAAAgB,QAAA,gBACElB,IAAA,CAACF,SAAS;MACRW,IAAI,EAAEA,IAAK;MACXJ,KAAK,EAAEM,WAAW,IAAIN,KAAM;MAC5BS,IAAI,EAAEA,IAAK;MAAA,GACPG,IAAI;MACRD,KAAK,EAAE,CACL;QACEG,KAAK,EAAEL,IAAI;QACXM,MAAM,EAAEN;MACV,CAAC,EACDE,KAAK;IACL,CACH,CAAC,EACDN,QAAQ,IAAIE,IAAI,gBACfZ,IAAA,CAACL,KAAK;MACJ0B,MAAM,EAAE;QAAEC,GAAG,EAAEV;MAAK,CAAE;MACtBI,KAAK,EAAE,CACLO,MAAM,CAACC,WAAW,EAClB;QACEL,KAAK,EAAEN,QAAQ;QACfO,MAAM,EAAEP;MACV,CAAC,EACDE,SAAS;IACT,CACH,CAAC,GACA,IAAI;EAAA,CACR,CAAC;AAEP,CAAC;AAED,MAAMQ,MAAM,GAAG1B,UAAU,CAAC4B,MAAM,CAAC;EAC/BD,WAAW,EAAE;IACXE,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAEF,eAAelB,UAAU","ignoreList":[]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
3
|
import { codegenNativeComponent } from 'react-native';
|
|
4
4
|
|
|
5
5
|
export interface BarCodeNativeComponentProps extends ViewProps {
|
|
6
|
-
/**
|
|
6
|
+
/** The data string to encode as barcode */
|
|
7
7
|
code?: string;
|
|
8
|
-
/**
|
|
8
|
+
/** Scale factor for the raw CIImage */
|
|
9
9
|
ratio?: Float;
|
|
10
|
-
/**
|
|
10
|
+
/** Pixel width of the final barcode */
|
|
11
11
|
width?: Int32;
|
|
12
|
-
/**
|
|
12
|
+
/** Pixel height of the final barcode */
|
|
13
13
|
height?: Int32;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { HostComponent, ViewProps, Float, Int32 } from 'react-native';
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
3
|
import { codegenNativeComponent } from 'react-native';
|
|
5
4
|
|
|
6
5
|
export interface QRCodeNativeComponentProps extends ViewProps {
|
|
6
|
+
/** The data string to encode as QR code */
|
|
7
7
|
code?: string;
|
|
8
|
+
/** Scale factor for the QR code */
|
|
8
9
|
ratio?: Float;
|
|
10
|
+
/** Size of the QR code in pixels */
|
|
9
11
|
size?: Int32;
|
|
10
12
|
}
|
|
11
13
|
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
import type { ViewStyle } from 'react-native';
|
|
2
4
|
type BarCodeViewProps = {
|
|
5
|
+
/** The data string to encode as barcode */
|
|
3
6
|
code: string;
|
|
7
|
+
/** Width of the barcode in pixels */
|
|
4
8
|
width: Int32;
|
|
9
|
+
/** Height of the barcode in pixels */
|
|
5
10
|
height: Int32;
|
|
11
|
+
/** Scale factor for the barcode (optional, defaults to device pixel ratio) */
|
|
6
12
|
ratio?: Float;
|
|
13
|
+
/** Style for the barcode container (optional) */
|
|
14
|
+
style?: ViewStyle;
|
|
7
15
|
};
|
|
8
|
-
declare const BarCodeView:
|
|
16
|
+
declare const BarCodeView: React.FC<BarCodeViewProps>;
|
|
9
17
|
export default BarCodeView;
|
|
10
18
|
//# sourceMappingURL=BarCodeView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarCodeView.d.ts","sourceRoot":"","sources":["../../../src/BarCodeView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BarCodeView.d.ts","sourceRoot":"","sources":["../../../src/BarCodeView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,KAAK,gBAAgB,GAAG;IACtB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,KAAK,EAAE,KAAK,CAAC;IACb,sCAAsC;IACtC,MAAM,EAAE,KAAK,CAAC;IACd,8EAA8E;IAC9E,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,iDAAiD;IACjD,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAwB3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,14 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
import type { ViewStyle, ImageStyle } from 'react-native';
|
|
2
4
|
type QRCodeViewProps = {
|
|
5
|
+
/** The data string to encode as QR code */
|
|
3
6
|
code: string;
|
|
7
|
+
/** Size of the QR code in pixels */
|
|
4
8
|
size: Int32;
|
|
9
|
+
/** Scale factor for the QR code (optional, defaults to device pixel ratio) */
|
|
5
10
|
ratio?: Float;
|
|
11
|
+
/** Icon URL to display over QR code (optional) */
|
|
6
12
|
icon?: string;
|
|
13
|
+
/** Whether to show logo overlay (optional, defaults to false) */
|
|
7
14
|
showLogo?: boolean;
|
|
15
|
+
/** Size of the icon overlay (optional, defaults to 32) */
|
|
8
16
|
iconSize?: Int32;
|
|
9
|
-
|
|
10
|
-
|
|
17
|
+
/** Style for the icon overlay (optional) */
|
|
18
|
+
iconStyle?: ImageStyle;
|
|
19
|
+
/** Style for the QR code container (optional) */
|
|
20
|
+
style?: ViewStyle;
|
|
11
21
|
};
|
|
12
|
-
declare const QRCodeView:
|
|
22
|
+
declare const QRCodeView: React.FC<QRCodeViewProps>;
|
|
13
23
|
export default QRCodeView;
|
|
14
24
|
//# sourceMappingURL=QRCodeView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QRCodeView.d.ts","sourceRoot":"","sources":["../../../src/QRCodeView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"QRCodeView.d.ts","sourceRoot":"","sources":["../../../src/QRCodeView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1D,KAAK,eAAe,GAAG;IACrB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,IAAI,EAAE,KAAK,CAAC;IACZ,8EAA8E;IAC9E,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,iDAAiD;IACjD,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAyCzC,CAAC;AAQF,eAAe,UAAU,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type { HostComponent, ViewProps
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
2
3
|
export interface BarCodeNativeComponentProps extends ViewProps {
|
|
3
|
-
/**
|
|
4
|
+
/** The data string to encode as barcode */
|
|
4
5
|
code?: string;
|
|
5
|
-
/**
|
|
6
|
+
/** Scale factor for the raw CIImage */
|
|
6
7
|
ratio?: Float;
|
|
7
|
-
/**
|
|
8
|
+
/** Pixel width of the final barcode */
|
|
8
9
|
width?: Int32;
|
|
9
|
-
/**
|
|
10
|
+
/** Pixel height of the final barcode */
|
|
10
11
|
height?: Int32;
|
|
11
12
|
}
|
|
12
13
|
declare const _default: HostComponent<BarCodeNativeComponentProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RCTBarCodeNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/RCTBarCodeNativeComponent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RCTBarCodeNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/RCTBarCodeNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAG9E,MAAM,WAAW,2BAA4B,SAAQ,SAAS;IAC5D,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,uCAAuC;IACvC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,wCAAwC;IACxC,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB;wBAII,aAAa,CAAC,2BAA2B,CAAC;AAF/C,wBAEgD"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import type { HostComponent, ViewProps
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
2
3
|
export interface QRCodeNativeComponentProps extends ViewProps {
|
|
4
|
+
/** The data string to encode as QR code */
|
|
3
5
|
code?: string;
|
|
6
|
+
/** Scale factor for the QR code */
|
|
4
7
|
ratio?: Float;
|
|
8
|
+
/** Size of the QR code in pixels */
|
|
5
9
|
size?: Int32;
|
|
6
10
|
}
|
|
7
11
|
declare const _default: HostComponent<QRCodeNativeComponentProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RCTQRCodeNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/RCTQRCodeNativeComponent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RCTQRCodeNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/RCTQRCodeNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAG9E,MAAM,WAAW,0BAA2B,SAAQ,SAAS;IAC3D,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,oCAAoC;IACpC,IAAI,CAAC,EAAE,KAAK,CAAC;CACd;wBAII,aAAa,CAAC,0BAA0B,CAAC;AAF9C,wBAE+C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/qrcode",
|
|
3
|
-
"version": "0.150.2-beta.
|
|
3
|
+
"version": "0.150.2-beta.8",
|
|
4
4
|
"description": "A simple and customizable QR code generator component for React Native apps.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
package/src/BarCodeView.tsx
CHANGED
|
@@ -1,16 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PixelRatio } from 'react-native';
|
|
1
3
|
import RCTBarCode from './RCTBarCodeNativeComponent';
|
|
2
4
|
import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
-
import {
|
|
5
|
+
import type { ViewStyle } from 'react-native';
|
|
4
6
|
|
|
5
7
|
type BarCodeViewProps = {
|
|
8
|
+
/** The data string to encode as barcode */
|
|
6
9
|
code: string;
|
|
10
|
+
/** Width of the barcode in pixels */
|
|
7
11
|
width: Int32;
|
|
12
|
+
/** Height of the barcode in pixels */
|
|
8
13
|
height: Int32;
|
|
14
|
+
/** Scale factor for the barcode (optional, defaults to device pixel ratio) */
|
|
9
15
|
ratio?: Float;
|
|
16
|
+
/** Style for the barcode container (optional) */
|
|
17
|
+
style?: ViewStyle;
|
|
10
18
|
};
|
|
11
19
|
|
|
12
|
-
const BarCodeView
|
|
13
|
-
|
|
20
|
+
const BarCodeView: React.FC<BarCodeViewProps> = ({
|
|
21
|
+
code,
|
|
22
|
+
width,
|
|
23
|
+
height,
|
|
24
|
+
ratio,
|
|
25
|
+
style,
|
|
26
|
+
...rest
|
|
27
|
+
}) => {
|
|
28
|
+
return (
|
|
29
|
+
<RCTBarCode
|
|
30
|
+
code={code}
|
|
31
|
+
width={width}
|
|
32
|
+
height={height}
|
|
33
|
+
ratio={ratio ?? PixelRatio.get()}
|
|
34
|
+
style={[
|
|
35
|
+
{
|
|
36
|
+
width,
|
|
37
|
+
height,
|
|
38
|
+
},
|
|
39
|
+
style,
|
|
40
|
+
]}
|
|
41
|
+
{...rest}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
14
44
|
};
|
|
15
45
|
|
|
16
46
|
export default BarCodeView;
|
package/src/QRCodeView.tsx
CHANGED
|
@@ -1,23 +1,33 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Image, PixelRatio, StyleSheet } from 'react-native';
|
|
2
3
|
import RCTQRCode from './RCTQRCodeNativeComponent';
|
|
3
4
|
import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
5
|
+
import type { ViewStyle, ImageStyle } from 'react-native';
|
|
4
6
|
|
|
5
7
|
const ratio = PixelRatio.get();
|
|
6
8
|
const ic_logo =
|
|
7
9
|
'https://img.mservice.io/momo_app_v2/new_version/img/appx_image/ic_momo.png';
|
|
8
10
|
|
|
9
11
|
type QRCodeViewProps = {
|
|
12
|
+
/** The data string to encode as QR code */
|
|
10
13
|
code: string;
|
|
14
|
+
/** Size of the QR code in pixels */
|
|
11
15
|
size: Int32;
|
|
16
|
+
/** Scale factor for the QR code (optional, defaults to device pixel ratio) */
|
|
12
17
|
ratio?: Float;
|
|
18
|
+
/** Icon URL to display over QR code (optional) */
|
|
13
19
|
icon?: string;
|
|
20
|
+
/** Whether to show logo overlay (optional, defaults to false) */
|
|
14
21
|
showLogo?: boolean;
|
|
22
|
+
/** Size of the icon overlay (optional, defaults to 32) */
|
|
15
23
|
iconSize?: Int32;
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
/** Style for the icon overlay (optional) */
|
|
25
|
+
iconStyle?: ImageStyle;
|
|
26
|
+
/** Style for the QR code container (optional) */
|
|
27
|
+
style?: ViewStyle;
|
|
18
28
|
};
|
|
19
29
|
|
|
20
|
-
const QRCodeView = ({
|
|
30
|
+
const QRCodeView: React.FC<QRCodeViewProps> = ({
|
|
21
31
|
code,
|
|
22
32
|
showLogo = false,
|
|
23
33
|
ratio: customRatio,
|
|
@@ -27,7 +37,7 @@ const QRCodeView = ({
|
|
|
27
37
|
iconStyle,
|
|
28
38
|
style,
|
|
29
39
|
...rest
|
|
30
|
-
}
|
|
40
|
+
}) => {
|
|
31
41
|
return (
|
|
32
42
|
<>
|
|
33
43
|
<RCTQRCode
|
|
@@ -43,14 +53,14 @@ const QRCodeView = ({
|
|
|
43
53
|
style,
|
|
44
54
|
]}
|
|
45
55
|
/>
|
|
46
|
-
{showLogo ? (
|
|
56
|
+
{showLogo && icon ? (
|
|
47
57
|
<Image
|
|
48
58
|
source={{ uri: icon }}
|
|
49
59
|
style={[
|
|
60
|
+
styles.logoOverlay,
|
|
50
61
|
{
|
|
51
62
|
width: iconSize,
|
|
52
63
|
height: iconSize,
|
|
53
|
-
position: 'absolute',
|
|
54
64
|
},
|
|
55
65
|
iconStyle,
|
|
56
66
|
]}
|
|
@@ -60,4 +70,10 @@ const QRCodeView = ({
|
|
|
60
70
|
);
|
|
61
71
|
};
|
|
62
72
|
|
|
73
|
+
const styles = StyleSheet.create({
|
|
74
|
+
logoOverlay: {
|
|
75
|
+
position: 'absolute',
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
|
|
63
79
|
export default QRCodeView;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
3
|
import { codegenNativeComponent } from 'react-native';
|
|
4
4
|
|
|
5
5
|
export interface BarCodeNativeComponentProps extends ViewProps {
|
|
6
|
-
/**
|
|
6
|
+
/** The data string to encode as barcode */
|
|
7
7
|
code?: string;
|
|
8
|
-
/**
|
|
8
|
+
/** Scale factor for the raw CIImage */
|
|
9
9
|
ratio?: Float;
|
|
10
|
-
/**
|
|
10
|
+
/** Pixel width of the final barcode */
|
|
11
11
|
width?: Int32;
|
|
12
|
-
/**
|
|
12
|
+
/** Pixel height of the final barcode */
|
|
13
13
|
height?: Int32;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { HostComponent, ViewProps, Float, Int32 } from 'react-native';
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
3
|
import { codegenNativeComponent } from 'react-native';
|
|
5
4
|
|
|
6
5
|
export interface QRCodeNativeComponentProps extends ViewProps {
|
|
6
|
+
/** The data string to encode as QR code */
|
|
7
7
|
code?: string;
|
|
8
|
+
/** Scale factor for the QR code */
|
|
8
9
|
ratio?: Float;
|
|
10
|
+
/** Size of the QR code in pixels */
|
|
9
11
|
size?: Int32;
|
|
10
12
|
}
|
|
11
13
|
|
package/ios/RCTBarCodeManager.mm
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#import <UIKit/UIKit.h>
|
|
2
|
-
#import <React/RCTViewManager.h>
|
|
3
|
-
#import "BarCodeView.h"
|
|
4
|
-
|
|
5
|
-
@implementation RCTBarCodeManager: RCTViewManager
|
|
6
|
-
RCT_EXPORT_VIEW_PROPERTY(code, NSString);
|
|
7
|
-
RCT_EXPORT_VIEW_PROPERTY(ratio, CGFloat);
|
|
8
|
-
RCT_EXPORT_VIEW_PROPERTY(width, NSInteger);
|
|
9
|
-
RCT_EXPORT_VIEW_PROPERTY(height, NSInteger);
|
|
10
|
-
RCT_EXPORT_MODULE(RCTBarCode)
|
|
11
|
-
- (UIView*)view {
|
|
12
|
-
BarCodeView* view = [[BarCodeView alloc] init];
|
|
13
|
-
return view;
|
|
14
|
-
}
|
|
15
|
-
@end
|
package/ios/RCTQRCodeManager.mm
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#import <React/RCTViewManager.h>
|
|
2
|
-
#import <UIKit/UIKit.h>
|
|
3
|
-
#import "QRCodeView.h"
|
|
4
|
-
|
|
5
|
-
@implementation RCTQRCodeManager: RCTViewManager
|
|
6
|
-
RCT_EXPORT_VIEW_PROPERTY(code, NSString);
|
|
7
|
-
RCT_EXPORT_VIEW_PROPERTY(ratio, CGFloat);
|
|
8
|
-
RCT_EXPORT_VIEW_PROPERTY(size, NSInteger);
|
|
9
|
-
|
|
10
|
-
RCT_EXPORT_MODULE(RCTQRCode)
|
|
11
|
-
- (UIView*)view {
|
|
12
|
-
QRCodeView* view = [[QRCodeView alloc] init];
|
|
13
|
-
return view;
|
|
14
|
-
}
|
|
15
|
-
@end
|