@momo-kits/qrcode 0.150.2-beta.test.7 → 0.150.2-phuc.13

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.
Files changed (41) hide show
  1. package/Qrcode.podspec +28 -18
  2. package/android/src/main/java/com/momokits/qrcode/MomoBarCodeViewManager.kt +6 -6
  3. package/android/src/main/java/com/momokits/qrcode/MomoQrCodeViewManager.kt +6 -6
  4. package/ios/{RCTBarCode.h → RNBarCode.h} +2 -2
  5. package/ios/{RCTBarCode.mm → RNBarCode.mm} +8 -8
  6. package/ios/RNQRCode.h +10 -0
  7. package/ios/RNQRCode.mm +66 -0
  8. package/lib/module/BarCodeView.js +2 -2
  9. package/lib/module/BarCodeView.js.map +1 -1
  10. package/lib/module/QRCodeView.js +2 -2
  11. package/lib/module/QRCodeView.js.map +1 -1
  12. package/{src/RCTBarCodeNativeComponent.ts → lib/module/RNBarCodeNativeComponent.ts} +6 -9
  13. package/lib/module/RNQRCodeNativeComponent.ts +10 -0
  14. package/lib/module/index.js +3 -3
  15. package/lib/module/index.js.map +1 -1
  16. package/lib/typescript/src/BarCodeView.d.ts +4 -4
  17. package/lib/typescript/src/BarCodeView.d.ts.map +1 -1
  18. package/lib/typescript/src/QRCodeView.d.ts +4 -4
  19. package/lib/typescript/src/QRCodeView.d.ts.map +1 -1
  20. package/lib/typescript/src/RNBarCodeNativeComponent.d.ts +15 -0
  21. package/lib/typescript/src/RNBarCodeNativeComponent.d.ts.map +1 -0
  22. package/lib/typescript/src/RNQRCodeNativeComponent.d.ts +10 -0
  23. package/lib/typescript/src/RNQRCodeNativeComponent.d.ts.map +1 -0
  24. package/lib/typescript/src/index.d.ts +3 -3
  25. package/lib/typescript/src/index.d.ts.map +1 -1
  26. package/package.json +3 -3
  27. package/src/BarCodeView.tsx +6 -7
  28. package/src/QRCodeView.tsx +6 -6
  29. package/{lib/module/RCTBarCodeNativeComponent.ts → src/RNBarCodeNativeComponent.ts} +6 -9
  30. package/src/RNQRCodeNativeComponent.ts +10 -0
  31. package/src/index.tsx +3 -3
  32. package/ios/RCTBarCodeManager.mm +0 -15
  33. package/ios/RCTQRCode.h +0 -15
  34. package/ios/RCTQRCode.mm +0 -147
  35. package/ios/RCTQRCodeManager.mm +0 -45
  36. package/lib/module/RCTQRCodeNativeComponent.ts +0 -11
  37. package/lib/typescript/src/RCTBarCodeNativeComponent.d.ts +0 -14
  38. package/lib/typescript/src/RCTBarCodeNativeComponent.d.ts.map +0 -1
  39. package/lib/typescript/src/RCTQRCodeNativeComponent.d.ts +0 -10
  40. package/lib/typescript/src/RCTQRCodeNativeComponent.d.ts.map +0 -1
  41. package/src/RCTQRCodeNativeComponent.ts +0 -14
package/Qrcode.podspec CHANGED
@@ -3,31 +3,41 @@ require "json"
3
3
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
4
 
5
5
  Pod::Spec.new do |s|
6
- s.name = "Qrcode"
7
- s.version = package["version"]
8
- s.summary = package["description"]
9
- s.description = package["description"]
10
- s.homepage = package["homepage"]
11
- s.license = package["license"]
12
- s.platforms = { :ios => "11.0" }
13
- s.author = package["author"]
14
- s.source = { :git => package["repository"]["url"], :tag => "#{s.version}" }
6
+ s.name = "Qrcode"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
15
12
 
16
- s.source_files = "ios/**/*.{h,m,mm,swift}"
17
- s.requires_arc = true
13
+ s.platforms = { :ios => min_ios_version_supported }
14
+ s.source = { :git => "https://www.npmjs.com/.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm}"
17
+ s.private_header_files = "ios/**/*.h"
18
18
 
19
- s.dependency "React-Core"
20
19
 
21
20
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
22
21
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
23
22
  if respond_to?(:install_modules_dependencies, true)
24
23
  install_modules_dependencies(s)
25
24
  else
26
- s.dependency "React-RCTFabric", "~> 0.72.0" # This dependency is managed by React Native.
27
- s.dependency "React-Codegen", "~> 0.72.0"
28
- s.dependency "RCT-Folly", "~> 2021.07.22.00"
29
- s.dependency "RCTRequired", "~> 0.72.0"
30
- s.dependency "RCTTypeSafety", "~> 0.72.0"
31
- s.dependency "ReactCommon", "~> 0.72.0"
25
+ s.dependency "React-Core"
26
+
27
+ # Don't install the dependencies when we run `pod install` in the old architecture.
28
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
29
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
30
+ s.pod_target_xcconfig = {
31
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
32
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
33
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
34
+ }
35
+ s.dependency "React-RCTFabric"
36
+ s.dependency "React-Codegen"
37
+ s.dependency "RCT-Folly"
38
+ s.dependency "RCTRequired"
39
+ s.dependency "RCTTypeSafety"
40
+ s.dependency "ReactCommon/turbomodule/core"
41
+ end
32
42
  end
33
43
  end
@@ -12,8 +12,8 @@ import com.facebook.react.uimanager.SimpleViewManager
12
12
  import com.facebook.react.uimanager.ThemedReactContext
13
13
  import com.facebook.react.uimanager.ViewManagerDelegate
14
14
  import com.facebook.react.uimanager.annotations.ReactProp
15
- import com.facebook.react.viewmanagers.BarCodeManagerInterface
16
- import com.facebook.react.viewmanagers.BarCodeManagerDelegate
15
+ import com.facebook.react.viewmanagers.RNBarCodeManagerInterface
16
+ import com.facebook.react.viewmanagers.RNBarCodeManagerDelegate
17
17
  import com.google.zxing.BarcodeFormat
18
18
  import com.google.zxing.EncodeHintType
19
19
  import com.google.zxing.WriterException
@@ -22,15 +22,15 @@ import com.google.zxing.oned.Code128Writer
22
22
 
23
23
  class MomoBarCodeViewManager :
24
24
  SimpleViewManager<ImageView>(), // base class
25
- BarCodeManagerInterface<ImageView> { // generated interface
25
+ RNBarCodeManagerInterface<ImageView> { // generated interface
26
26
 
27
27
  companion object {
28
- const val REACT_CLASS = "RCTBarCode"
28
+ const val REACT_CLASS = "RNBarCode"
29
29
  }
30
30
 
31
31
  // wire up the delegate
32
- private val delegate: BarCodeManagerDelegate<ImageView, MomoBarCodeViewManager> =
33
- BarCodeManagerDelegate(this)
32
+ private val delegate: RNBarCodeManagerDelegate<ImageView, MomoBarCodeViewManager> =
33
+ RNBarCodeManagerDelegate(this)
34
34
 
35
35
  override fun getName() = REACT_CLASS
36
36
 
@@ -10,8 +10,8 @@ import com.facebook.react.uimanager.SimpleViewManager
10
10
  import com.facebook.react.uimanager.ThemedReactContext
11
11
  import com.facebook.react.uimanager.ViewManagerDelegate
12
12
  import com.facebook.react.uimanager.annotations.ReactProp
13
- import com.facebook.react.viewmanagers.QRCodeManagerDelegate
14
- import com.facebook.react.viewmanagers.QRCodeManagerInterface
13
+ import com.facebook.react.viewmanagers.RNQRCodeManagerDelegate
14
+ import com.facebook.react.viewmanagers.RNQRCodeManagerInterface
15
15
  import com.google.zxing.BarcodeFormat
16
16
  import com.google.zxing.EncodeHintType
17
17
  import com.google.zxing.WriterException
@@ -23,7 +23,7 @@ import kotlin.math.floor
23
23
 
24
24
  class MomoQrCodeViewManager :
25
25
  SimpleViewManager<ImageView>(),
26
- QRCodeManagerInterface<ImageView> {
26
+ RNQRCodeManagerInterface<ImageView> {
27
27
 
28
28
  private var code: String? = null
29
29
  private var size: Int = 200
@@ -34,11 +34,11 @@ class MomoQrCodeViewManager :
34
34
  private val code128Writer = Code128Writer()
35
35
 
36
36
  companion object {
37
- const val REACT_CLASS = "RCTQRCode"
37
+ const val REACT_CLASS = "RNQRCode"
38
38
  }
39
39
 
40
- private val delegate: QRCodeManagerDelegate<ImageView, MomoQrCodeViewManager> =
41
- QRCodeManagerDelegate(this)
40
+ private val delegate: RNQRCodeManagerDelegate<ImageView, MomoQrCodeViewManager> =
41
+ RNQRCodeManagerDelegate(this)
42
42
 
43
43
  override fun getName() = REACT_CLASS
44
44
 
@@ -1,11 +1,11 @@
1
- // RCTBarCode.h
1
+ // RNBarCode.h
2
2
 
3
3
  #import <React/RCTViewComponentView.h>
4
4
  #import <UIKit/UIKit.h>
5
5
 
6
6
  NS_ASSUME_NONNULL_BEGIN
7
7
 
8
- @interface RCTBarCode : RCTViewComponentView
8
+ @interface RNBarCode : RCTViewComponentView
9
9
  @end
10
10
 
11
11
  NS_ASSUME_NONNULL_END
@@ -1,6 +1,6 @@
1
- // RCTBarCode.mm
1
+ // RNBarCode.mm
2
2
 
3
- #import "RCTBarCode.h"
3
+ #import "RNBarCode.h"
4
4
  #import <react/renderer/components/QrcodeViewSpec/ComponentDescriptors.h>
5
5
  #import <react/renderer/components/QrcodeViewSpec/Props.h>
6
6
  #import <react/renderer/components/QrcodeViewSpec/RCTComponentViewHelpers.h>
@@ -10,10 +10,10 @@
10
10
 
11
11
  using namespace facebook::react;
12
12
 
13
- @interface RCTBarCode () <RCTRCTBarCodeViewProtocol>
13
+ @interface RNBarCode () <RCTRNBarCodeViewProtocol>
14
14
  @end
15
15
 
16
- @implementation RCTBarCode {
16
+ @implementation RNBarCode {
17
17
  BarCodeView *_barcodeView;
18
18
  }
19
19
 
@@ -30,7 +30,7 @@ using namespace facebook::react;
30
30
  oldProps:(Props::Shared const &)oldProps
31
31
  {
32
32
  const auto &barProps =
33
- *std::static_pointer_cast<RCTBarCodeProps const>(props);
33
+ *std::static_pointer_cast<RNBarCodeProps const>(props);
34
34
 
35
35
  // string → NSString*
36
36
  if (!barProps.code.empty()) {
@@ -52,12 +52,12 @@ using namespace facebook::react;
52
52
 
53
53
  + (ComponentDescriptorProvider)componentDescriptorProvider
54
54
  {
55
- return concreteComponentDescriptorProvider<RCTBarCodeComponentDescriptor>();
55
+ return concreteComponentDescriptorProvider<RNBarCodeComponentDescriptor>();
56
56
  }
57
57
 
58
58
  @end
59
59
 
60
- Class<RCTRCTBarCodeViewProtocol> RCTBarCodeCls(void)
60
+ Class<RCTRNBarCodeViewProtocol> RCTBarCodeCls(void)
61
61
  {
62
- return RCTBarCode.class;
62
+ return RNBarCode.class;
63
63
  }
package/ios/RNQRCode.h ADDED
@@ -0,0 +1,10 @@
1
+ #import <React/RCTViewComponentView.h>
2
+ #import <UIKit/UIKit.h>
3
+
4
+ NS_ASSUME_NONNULL_BEGIN
5
+
6
+ @interface RNQRCode : RCTViewComponentView
7
+
8
+ @end
9
+
10
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,66 @@
1
+ #import "RNQRCode.h"
2
+ #import <react/renderer/components/QrcodeViewSpec/ComponentDescriptors.h>
3
+ #import <react/renderer/components/QrcodeViewSpec/Props.h>
4
+ #import <react/renderer/components/QrcodeViewSpec/RCTComponentViewHelpers.h>
5
+ #import <react/renderer/components/QrcodeViewSpec/EventEmitters.h>
6
+ #import "QRCodeView.h"
7
+ #import <React/RCTLog.h>
8
+
9
+ #import "RCTFabricComponentsPlugins.h"
10
+
11
+ using namespace facebook::react;
12
+
13
+ @interface RNQRCode () <RCTRNQRCodeViewProtocol>
14
+ @end
15
+
16
+ @implementation RNQRCode {
17
+ QRCodeView *_qrView;
18
+ }
19
+
20
+ - (instancetype)init
21
+ {
22
+ if (self = [super init]) {
23
+ // Create and embed your existing UIImageView-based QRCodeView
24
+ _qrView = [QRCodeView new];
25
+ [self addSubview:_qrView];
26
+ }
27
+ return self;
28
+ }
29
+
30
+ - (void)updateProps:(Props::Shared const &)props
31
+ oldProps:(Props::Shared const &)oldProps
32
+ {
33
+ // Pull in the generated Props struct
34
+ const auto &qrProps = *std::static_pointer_cast<RNQRCodeProps const>(props);
35
+
36
+ // Apply to your view
37
+ if (!qrProps.code.empty()) {
38
+ NSString *nsCode = [NSString stringWithUTF8String:qrProps.code.c_str()];
39
+ _qrView.code = nsCode;
40
+ }
41
+ _qrView.ratio = qrProps.ratio;
42
+ _qrView.size = qrProps.size;
43
+ NSLog(@"[QRCodeView] setCode: %@", _qrView.code);
44
+
45
+ [super updateProps:props oldProps:oldProps];
46
+ }
47
+
48
+ - (void)layoutSubviews
49
+ {
50
+ [super layoutSubviews];
51
+ // Make the QR image fill the host view
52
+ _qrView.frame = self.bounds;
53
+ }
54
+
55
+ + (ComponentDescriptorProvider)componentDescriptorProvider
56
+ {
57
+ // Hook up to the C++ ComponentDescriptor generated by Codegen
58
+ return concreteComponentDescriptorProvider<RNQRCodeComponentDescriptor>();
59
+ }
60
+
61
+ @end
62
+
63
+ Class<RCTRNQRCodeViewProtocol> RCTQRCodeCls(void)
64
+ {
65
+ return RNQRCode.class;
66
+ }
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
 
3
- import RCTBarCode from './RCTBarCodeNativeComponent';
3
+ import RNBarCode from './RNBarCodeNativeComponent';
4
4
  import { PixelRatio } from 'react-native';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  const BarCodeView = ({
7
7
  ratio,
8
8
  ...props
9
9
  }) => {
10
- return /*#__PURE__*/_jsx(RCTBarCode, {
10
+ return /*#__PURE__*/_jsx(RNBarCode, {
11
11
  ratio: ratio ?? PixelRatio.get(),
12
12
  ...props
13
13
  });
@@ -1 +1 @@
1
- {"version":3,"names":["RCTBarCode","PixelRatio","jsx","_jsx","BarCodeView","ratio","props","get"],"sourceRoot":"../../src","sources":["BarCodeView.tsx"],"mappings":";;AAAA,OAAOA,UAAU,MAAM,6BAA6B;AAEpD,SAASC,UAAU,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAS1C,MAAMC,WAAW,GAAGA,CAAC;EAAEC,KAAK;EAAE,GAAGC;AAAwB,CAAC,KAAK;EAC7D,oBAAOH,IAAA,CAACH,UAAU;IAACK,KAAK,EAAEA,KAAK,IAAIJ,UAAU,CAACM,GAAG,CAAC,CAAE;IAAA,GAAKD;EAAK,CAAG,CAAC;AACpE,CAAC;AAED,eAAeF,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["RNBarCode","PixelRatio","jsx","_jsx","BarCodeView","ratio","props","get"],"sourceRoot":"../../src","sources":["BarCodeView.tsx"],"mappings":";;AAAA,OAAOA,SAAS,MAAM,4BAA4B;AAClD,SAASC,UAAU,QAAsB,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AASxD,MAAMC,WAAW,GAAGA,CAAC;EAAEC,KAAK;EAAE,GAAGC;AAAwB,CAAC,KAAK;EAC7D,oBAAOH,IAAA,CAACH,SAAS;IAACK,KAAK,EAAEA,KAAK,IAAIJ,UAAU,CAACM,GAAG,CAAC,CAAE;IAAA,GAAKD;EAAK,CAAG,CAAC;AACnE,CAAC;AAED,eAAeF,WAAW","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import { Image, PixelRatio } from 'react-native';
4
- import RCTQRCode from './RCTQRCodeNativeComponent';
4
+ import RNQRCode from './RNQRCodeNativeComponent';
5
5
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  const ratio = PixelRatio.get();
7
7
  const ic_logo = 'https://img.mservice.io/momo_app_v2/new_version/img/appx_image/ic_momo.png';
@@ -17,7 +17,7 @@ const QRCodeView = ({
17
17
  ...rest
18
18
  }) => {
19
19
  return /*#__PURE__*/_jsxs(_Fragment, {
20
- children: [/*#__PURE__*/_jsx(RCTQRCode, {
20
+ children: [/*#__PURE__*/_jsx(RNQRCode, {
21
21
  code: code,
22
22
  ratio: customRatio ?? ratio,
23
23
  size: size,
@@ -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,SAASA,KAAK,EAAEC,UAAU,QAAQ,cAAc;AAChD,OAAOC,SAAS,MAAM,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAGnD,MAAMC,KAAK,GAAGR,UAAU,CAACS,GAAG,CAAC,CAAC;AAC9B,MAAMC,OAAO,GACX,4EAA4E;AAa9E,MAAMC,UAAU,GAAGA,CAAC;EAClBC,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;AACY,CAAC,KAAK;EACrB,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,gBACPV,IAAA,CAACJ,KAAK;MACJyB,MAAM,EAAE;QAAEC,GAAG,EAAEV;MAAK,CAAE;MACtBI,KAAK,EAAE,CACL;QACEG,KAAK,EAAEN,QAAQ;QACfO,MAAM,EAAEP,QAAQ;QAChBU,QAAQ,EAAE;MACZ,CAAC,EACDR,SAAS;IACT,CACH,CAAC,GACA,IAAI;EAAA,CACR,CAAC;AAEP,CAAC;AAED,eAAeP,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["Image","PixelRatio","RNQRCode","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,SAASA,KAAK,EAAEC,UAAU,QAAQ,cAAc;AAChD,OAAOC,QAAQ,MAAM,2BAA2B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAGjD,MAAMC,KAAK,GAAGR,UAAU,CAACS,GAAG,CAAC,CAAC;AAC9B,MAAMC,OAAO,GACX,4EAA4E;AAa9E,MAAMC,UAAU,GAAGA,CAAC;EAClBC,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;AACY,CAAC,KAAK;EACrB,oBACEb,KAAA,CAAAF,SAAA;IAAAgB,QAAA,gBACElB,IAAA,CAACF,QAAQ;MACPW,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,gBACPV,IAAA,CAACJ,KAAK;MACJyB,MAAM,EAAE;QAAEC,GAAG,EAAEV;MAAK,CAAE;MACtBI,KAAK,EAAE,CACL;QACEG,KAAK,EAAEN,QAAQ;QACfO,MAAM,EAAEP,QAAQ;QAChBU,QAAQ,EAAE;MACZ,CAAC,EACDR,SAAS;IACT,CACH,CAAC,GACA,IAAI;EAAA,CACR,CAAC;AAEP,CAAC;AAED,eAAeP,UAAU","ignoreList":[]}
@@ -1,18 +1,15 @@
1
- // @ts-nocheck
2
- import type { HostComponent, ViewProps, Float, Int32 } from 'react-native';
3
- import { codegenNativeComponent } from 'react-native';
1
+ import type { ViewProps } from 'react-native';
2
+ import { codegenNativeComponent, CodegenTypes } from 'react-native';
4
3
 
5
4
  export interface BarCodeNativeComponentProps extends ViewProps {
6
5
  /** the data string to encode */
7
6
  code?: string;
8
7
  /** scale-factor for the raw CIImage */
9
- ratio?: Float;
8
+ ratio?: CodegenTypes.Float;
10
9
  /** pixel width of the final barcode */
11
- width?: Int32;
10
+ width?: CodegenTypes.Int32;
12
11
  /** pixel height of the final barcode */
13
- height?: Int32;
12
+ height?: CodegenTypes.Int32;
14
13
  }
15
14
 
16
- export default codegenNativeComponent<BarCodeNativeComponentProps>(
17
- 'RCTBarCode'
18
- ) as HostComponent<BarCodeNativeComponentProps>;
15
+ export default codegenNativeComponent<BarCodeNativeComponentProps>('RNBarCode');
@@ -0,0 +1,10 @@
1
+ import type { ViewProps } from 'react-native';
2
+ import { codegenNativeComponent, CodegenTypes } from 'react-native';
3
+
4
+ export interface QRCodeNativeComponentProps extends ViewProps {
5
+ code?: string;
6
+ ratio?: CodegenTypes.Float;
7
+ size?: CodegenTypes.Int32;
8
+ }
9
+
10
+ export default codegenNativeComponent<QRCodeNativeComponentProps>('RNQRCode');
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
- import RCTQRCode from './RCTQRCodeNativeComponent';
4
- import RCTBarCode from './RCTBarCodeNativeComponent';
3
+ import RNQRCode from './RNQRCodeNativeComponent';
4
+ import RNBarCode from './RNBarCodeNativeComponent';
5
5
  import BarCodeView from "./BarCodeView.js";
6
6
  import QRCodeView from "./QRCodeView.js";
7
- export { BarCodeView, QRCodeView, RCTQRCode, RCTBarCode };
7
+ export { BarCodeView, QRCodeView, RNQRCode, RNBarCode };
8
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["RCTQRCode","RCTBarCode","BarCodeView","QRCodeView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,SAAS,MAAM,4BAA4B;AAClD,OAAOC,UAAU,MAAM,6BAA6B;AACpD,OAAOC,WAAW,MAAM,kBAAe;AACvC,OAAOC,UAAU,MAAM,iBAAc;AAErC,SAASD,WAAW,EAAEC,UAAU,EAAEH,SAAS,EAAEC,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["RNQRCode","RNBarCode","BarCodeView","QRCodeView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,QAAQ,MAAM,2BAA2B;AAChD,OAAOC,SAAS,MAAM,4BAA4B;AAClD,OAAOC,WAAW,MAAM,kBAAe;AACvC,OAAOC,UAAU,MAAM,iBAAc;AAErC,SAASD,WAAW,EAAEC,UAAU,EAAEH,QAAQ,EAAEC,SAAS","ignoreList":[]}
@@ -1,9 +1,9 @@
1
- import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
1
+ import { CodegenTypes } from 'react-native';
2
2
  type BarCodeViewProps = {
3
3
  code: string;
4
- width: Int32;
5
- height: Int32;
6
- ratio?: Float;
4
+ width: CodegenTypes.Int32;
5
+ height: CodegenTypes.Int32;
6
+ ratio?: CodegenTypes.Float;
7
7
  };
8
8
  declare const BarCodeView: ({ ratio, ...props }: BarCodeViewProps) => import("react/jsx-runtime").JSX.Element;
9
9
  export default BarCodeView;
@@ -1 +1 @@
1
- {"version":3,"file":"BarCodeView.d.ts","sourceRoot":"","sources":["../../../src/BarCodeView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAG9E,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,KAAK,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,QAAA,MAAM,WAAW,GAAI,qBAAqB,gBAAgB,4CAEzD,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"BarCodeView.d.ts","sourceRoot":"","sources":["../../../src/BarCodeView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,YAAY,EAAE,MAAM,cAAc,CAAC;AAExD,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;IAC1B,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;CAC5B,CAAC;AAEF,QAAA,MAAM,WAAW,GAAI,qBAAqB,gBAAgB,4CAEzD,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,11 +1,11 @@
1
- import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
1
+ import type { CodegenTypes } from 'react-native';
2
2
  type QRCodeViewProps = {
3
3
  code: string;
4
- size: Int32;
5
- ratio?: Float;
4
+ size: CodegenTypes.Int32;
5
+ ratio?: CodegenTypes.Float;
6
6
  icon?: string;
7
7
  showLogo?: boolean;
8
- iconSize?: Int32;
8
+ iconSize?: CodegenTypes.Int32;
9
9
  iconStyle?: any;
10
10
  style?: any;
11
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"QRCodeView.d.ts","sourceRoot":"","sources":["../../../src/QRCodeView.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAM9E,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb,CAAC;AAEF,QAAA,MAAM,UAAU,GAAI,yFAUjB,eAAe,4CA+BjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"QRCodeView.d.ts","sourceRoot":"","sources":["../../../src/QRCodeView.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAMjD,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC;IACzB,KAAK,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;IAC9B,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb,CAAC;AAEF,QAAA,MAAM,UAAU,GAAI,yFAUjB,eAAe,4CA+BjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { ViewProps } from 'react-native';
2
+ import { CodegenTypes } from 'react-native';
3
+ export interface BarCodeNativeComponentProps extends ViewProps {
4
+ /** the data string to encode */
5
+ code?: string;
6
+ /** scale-factor for the raw CIImage */
7
+ ratio?: CodegenTypes.Float;
8
+ /** pixel width of the final barcode */
9
+ width?: CodegenTypes.Int32;
10
+ /** pixel height of the final barcode */
11
+ height?: CodegenTypes.Int32;
12
+ }
13
+ declare const _default: import("react-native").HostComponent<BarCodeNativeComponentProps>;
14
+ export default _default;
15
+ //# sourceMappingURL=RNBarCodeNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RNBarCodeNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/RNBarCodeNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAA0B,YAAY,EAAE,MAAM,cAAc,CAAC;AAEpE,MAAM,WAAW,2BAA4B,SAAQ,SAAS;IAC5D,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,KAAK,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;IAC3B,uCAAuC;IACvC,KAAK,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;IAC3B,wCAAwC;IACxC,MAAM,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;CAC7B;;AAED,wBAAgF"}
@@ -0,0 +1,10 @@
1
+ import type { ViewProps } from 'react-native';
2
+ import { CodegenTypes } from 'react-native';
3
+ export interface QRCodeNativeComponentProps extends ViewProps {
4
+ code?: string;
5
+ ratio?: CodegenTypes.Float;
6
+ size?: CodegenTypes.Int32;
7
+ }
8
+ declare const _default: import("react-native").HostComponent<QRCodeNativeComponentProps>;
9
+ export default _default;
10
+ //# sourceMappingURL=RNQRCodeNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RNQRCodeNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/RNQRCodeNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAA0B,YAAY,EAAE,MAAM,cAAc,CAAC;AAEpE,MAAM,WAAW,0BAA2B,SAAQ,SAAS;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;IAC3B,IAAI,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;CAC3B;;AAED,wBAA8E"}
@@ -1,6 +1,6 @@
1
- import RCTQRCode from './RCTQRCodeNativeComponent';
2
- import RCTBarCode from './RCTBarCodeNativeComponent';
1
+ import RNQRCode from './RNQRCodeNativeComponent';
2
+ import RNBarCode from './RNBarCodeNativeComponent';
3
3
  import BarCodeView from './BarCodeView';
4
4
  import QRCodeView from './QRCodeView';
5
- export { BarCodeView, QRCodeView, RCTQRCode, RCTBarCode };
5
+ export { BarCodeView, QRCodeView, RNQRCode, RNBarCode };
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,4BAA4B,CAAC;AACnD,OAAO,UAAU,MAAM,6BAA6B,CAAC;AACrD,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AACjD,OAAO,SAAS,MAAM,4BAA4B,CAAC;AACnD,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/qrcode",
3
- "version": "0.150.2-beta.test.7",
3
+ "version": "0.150.2-phuc.13",
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",
@@ -157,8 +157,8 @@
157
157
  },
158
158
  "ios": {
159
159
  "componentProvider": {
160
- "RCTBarCode": "RCTBarCode",
161
- "RCTQRCode": "RCTQRCode"
160
+ "RNBarCode": "RNBarCode",
161
+ "RNQRCode": "RNQRCode"
162
162
  }
163
163
  }
164
164
  },
@@ -1,16 +1,15 @@
1
- import RCTBarCode from './RCTBarCodeNativeComponent';
2
- import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
3
- import { PixelRatio } from 'react-native';
1
+ import RNBarCode from './RNBarCodeNativeComponent';
2
+ import { PixelRatio, CodegenTypes } from 'react-native';
4
3
 
5
4
  type BarCodeViewProps = {
6
5
  code: string;
7
- width: Int32;
8
- height: Int32;
9
- ratio?: Float;
6
+ width: CodegenTypes.Int32;
7
+ height: CodegenTypes.Int32;
8
+ ratio?: CodegenTypes.Float;
10
9
  };
11
10
 
12
11
  const BarCodeView = ({ ratio, ...props }: BarCodeViewProps) => {
13
- return <RCTBarCode ratio={ratio ?? PixelRatio.get()} {...props} />;
12
+ return <RNBarCode ratio={ratio ?? PixelRatio.get()} {...props} />;
14
13
  };
15
14
 
16
15
  export default BarCodeView;
@@ -1,6 +1,6 @@
1
1
  import { Image, PixelRatio } from 'react-native';
2
- import RCTQRCode from './RCTQRCodeNativeComponent';
3
- import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
2
+ import RNQRCode from './RNQRCodeNativeComponent';
3
+ import type { CodegenTypes } from 'react-native';
4
4
 
5
5
  const ratio = PixelRatio.get();
6
6
  const ic_logo =
@@ -8,11 +8,11 @@ const ic_logo =
8
8
 
9
9
  type QRCodeViewProps = {
10
10
  code: string;
11
- size: Int32;
12
- ratio?: Float;
11
+ size: CodegenTypes.Int32;
12
+ ratio?: CodegenTypes.Float;
13
13
  icon?: string;
14
14
  showLogo?: boolean;
15
- iconSize?: Int32;
15
+ iconSize?: CodegenTypes.Int32;
16
16
  iconStyle?: any;
17
17
  style?: any;
18
18
  };
@@ -30,7 +30,7 @@ const QRCodeView = ({
30
30
  }: QRCodeViewProps) => {
31
31
  return (
32
32
  <>
33
- <RCTQRCode
33
+ <RNQRCode
34
34
  code={code}
35
35
  ratio={customRatio ?? ratio}
36
36
  size={size}
@@ -1,18 +1,15 @@
1
- // @ts-nocheck
2
- import type { HostComponent, ViewProps, Float, Int32 } from 'react-native';
3
- import { codegenNativeComponent } from 'react-native';
1
+ import type { ViewProps } from 'react-native';
2
+ import { codegenNativeComponent, CodegenTypes } from 'react-native';
4
3
 
5
4
  export interface BarCodeNativeComponentProps extends ViewProps {
6
5
  /** the data string to encode */
7
6
  code?: string;
8
7
  /** scale-factor for the raw CIImage */
9
- ratio?: Float;
8
+ ratio?: CodegenTypes.Float;
10
9
  /** pixel width of the final barcode */
11
- width?: Int32;
10
+ width?: CodegenTypes.Int32;
12
11
  /** pixel height of the final barcode */
13
- height?: Int32;
12
+ height?: CodegenTypes.Int32;
14
13
  }
15
14
 
16
- export default codegenNativeComponent<BarCodeNativeComponentProps>(
17
- 'RCTBarCode'
18
- ) as HostComponent<BarCodeNativeComponentProps>;
15
+ export default codegenNativeComponent<BarCodeNativeComponentProps>('RNBarCode');
@@ -0,0 +1,10 @@
1
+ import type { ViewProps } from 'react-native';
2
+ import { codegenNativeComponent, CodegenTypes } from 'react-native';
3
+
4
+ export interface QRCodeNativeComponentProps extends ViewProps {
5
+ code?: string;
6
+ ratio?: CodegenTypes.Float;
7
+ size?: CodegenTypes.Int32;
8
+ }
9
+
10
+ export default codegenNativeComponent<QRCodeNativeComponentProps>('RNQRCode');
package/src/index.tsx CHANGED
@@ -1,6 +1,6 @@
1
- import RCTQRCode from './RCTQRCodeNativeComponent';
2
- import RCTBarCode from './RCTBarCodeNativeComponent';
1
+ import RNQRCode from './RNQRCodeNativeComponent';
2
+ import RNBarCode from './RNBarCodeNativeComponent';
3
3
  import BarCodeView from './BarCodeView';
4
4
  import QRCodeView from './QRCodeView';
5
5
 
6
- export { BarCodeView, QRCodeView, RCTQRCode, RCTBarCode };
6
+ export { BarCodeView, QRCodeView, RNQRCode, RNBarCode };
@@ -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/RCTQRCode.h DELETED
@@ -1,15 +0,0 @@
1
- #ifdef RCT_NEW_ARCH_ENABLED
2
- #import <React/RCTViewComponentView.h>
3
-
4
- @interface RCTQRCode : RCTViewComponentView
5
- #else
6
- #import <UIKit/UIKit.h>
7
-
8
- @interface RCTQRCode : UIView
9
- #endif
10
-
11
- @property (nonatomic, copy) NSString *code;
12
- @property (nonatomic, strong) NSNumber *size;
13
- @property (nonatomic, strong) NSNumber *ratio;
14
-
15
- @end
package/ios/RCTQRCode.mm DELETED
@@ -1,147 +0,0 @@
1
- #import "RCTQRCode.h"
2
-
3
- #ifdef RCT_NEW_ARCH_ENABLED
4
- #import <React/RCTConversions.h>
5
- #import <React/RCTConvert.h>
6
- #import <react/renderer/components/QrcodeViewSpec/ComponentDescriptors.h>
7
- #import <react/renderer/components/QrcodeViewSpec/EventEmitters.h>
8
- #import <react/renderer/components/QrcodeViewSpec/Props.h>
9
- #import <react/renderer/components/QrcodeViewSpec/RCTComponentViewHelpers.h>
10
-
11
- using namespace facebook::react;
12
-
13
- @interface RCTQRCode () <RCTRCTQRCodeViewProtocol>
14
- @end
15
- #endif
16
-
17
- #import <CoreImage/CoreImage.h>
18
-
19
- @implementation RCTQRCode {
20
- UIImageView *_qrImageView;
21
- #ifndef RCT_NEW_ARCH_ENABLED
22
- NSString *_code;
23
- NSNumber *_size;
24
- NSNumber *_ratio;
25
- #endif
26
- }
27
-
28
- #ifdef RCT_NEW_ARCH_ENABLED
29
- + (ComponentDescriptorProvider)componentDescriptorProvider
30
- {
31
- return concreteComponentDescriptorProvider<RCTQRCodeComponentDescriptor>();
32
- }
33
- #endif
34
-
35
- - (instancetype)initWithFrame:(CGRect)frame
36
- {
37
- if (self = [super initWithFrame:frame]) {
38
- #ifdef RCT_NEW_ARCH_ENABLED
39
- static const auto defaultProps = std::make_shared<const RCTQRCodeProps>();
40
- _props = defaultProps;
41
- #else
42
- _size = @200;
43
- _ratio = @1.0;
44
- #endif
45
-
46
- _qrImageView = [[UIImageView alloc] init];
47
- _qrImageView.contentMode = UIViewContentModeScaleAspectFit;
48
- [self addSubview:_qrImageView];
49
- }
50
-
51
- return self;
52
- }
53
-
54
- - (void)layoutSubviews
55
- {
56
- [super layoutSubviews];
57
- _qrImageView.frame = self.bounds;
58
- }
59
-
60
- #ifdef RCT_NEW_ARCH_ENABLED
61
- - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
62
- {
63
- const auto &oldViewProps = *std::static_pointer_cast<RCTQRCodeProps const>(_props);
64
- const auto &newViewProps = *std::static_pointer_cast<RCTQRCodeProps const>(props);
65
-
66
- if (oldViewProps.code != newViewProps.code ||
67
- oldViewProps.size != newViewProps.size ||
68
- oldViewProps.ratio != newViewProps.ratio) {
69
- [self generateQRCode];
70
- }
71
-
72
- [super updateProps:props oldProps:oldProps];
73
- }
74
- #else
75
- - (void)setCode:(NSString *)code
76
- {
77
- _code = code;
78
- [self generateQRCode];
79
- }
80
-
81
- - (void)setSize:(NSNumber *)size
82
- {
83
- _size = size;
84
- [self generateQRCode];
85
- }
86
-
87
- - (void)setRatio:(NSNumber *)ratio
88
- {
89
- _ratio = ratio;
90
- [self generateQRCode];
91
- }
92
- #endif
93
-
94
- - (void)generateQRCode
95
- {
96
- #ifdef RCT_NEW_ARCH_ENABLED
97
- const auto &props = *std::static_pointer_cast<RCTQRCodeProps const>(_props);
98
- NSString *code = RCTNSStringFromString(props.code);
99
- CGFloat size = props.size;
100
- CGFloat ratio = props.ratio.value_or(1.0);
101
- #else
102
- NSString *code = _code;
103
- CGFloat size = [_size floatValue];
104
- CGFloat ratio = [_ratio floatValue];
105
- #endif
106
-
107
- if (!code || code.length == 0) {
108
- _qrImageView.image = nil;
109
- return;
110
- }
111
-
112
- // Generate QR Code
113
- CIFilter *filter = [CIFilter filterWithName:@"CIQRCodeGenerator"];
114
- [filter setDefaults];
115
-
116
- NSData *data = [code dataUsingEncoding:NSUTF8StringEncoding];
117
- [filter setValue:data forKey:@"inputMessage"];
118
-
119
- CIImage *ciImage = [filter outputImage];
120
-
121
- if (!ciImage) {
122
- _qrImageView.image = nil;
123
- return;
124
- }
125
-
126
- // Scale the image
127
- CGFloat scaleX = size * ratio / ciImage.extent.size.width;
128
- CGFloat scaleY = size * ratio / ciImage.extent.size.height;
129
- CIImage *scaledImage = [ciImage imageByApplyingTransform:CGAffineTransformMakeScale(scaleX, scaleY)];
130
-
131
- // Convert to UIImage
132
- CIContext *context = [CIContext context];
133
- CGImageRef cgImage = [context createCGImage:scaledImage fromRect:scaledImage.extent];
134
- UIImage *qrImage = [UIImage imageWithCGImage:cgImage];
135
- CGImageRelease(cgImage);
136
-
137
- _qrImageView.image = qrImage;
138
- }
139
-
140
- #ifdef RCT_NEW_ARCH_ENABLED
141
- Class<RCTComponentViewProtocol> RCTQRCodeCls(void)
142
- {
143
- return RCTQRCode.class;
144
- }
145
- #endif
146
-
147
- @end
@@ -1,45 +0,0 @@
1
- #import <React/RCTViewManager.h>
2
- #import <React/RCTUIManager.h>
3
- #import "RCTQRCode.h"
4
-
5
- @interface RCTQRCodeManager : RCTViewManager
6
- @end
7
-
8
- @implementation RCTQRCodeManager
9
-
10
- RCT_EXPORT_MODULE(RCTQRCode)
11
-
12
- RCT_EXPORT_VIEW_PROPERTY(code, NSString)
13
- RCT_EXPORT_VIEW_PROPERTY(size, NSNumber)
14
- RCT_EXPORT_VIEW_PROPERTY(ratio, NSNumber)
15
-
16
- - (UIView *)view
17
- {
18
- return [[RCTQRCode alloc] init];
19
- }
20
-
21
- - (dispatch_queue_t)methodQueue
22
- {
23
- return dispatch_get_main_queue();
24
- }
25
-
26
- + (BOOL)requiresMainQueueSetup
27
- {
28
- return NO;
29
- }
30
-
31
- @end
32
-
33
- #ifdef RCT_NEW_ARCH_ENABLED
34
- Class<RCTComponentViewProtocol> RCTQRCodeCls(void);
35
-
36
- @interface RCTQRCodeManager (Fabric) <RCTTurboModule>
37
- @end
38
-
39
- @implementation RCTQRCodeManager (Fabric)
40
- - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params
41
- {
42
- return nullptr;
43
- }
44
- @end
45
- #endif
@@ -1,11 +0,0 @@
1
- import type { ViewProps } from 'react-native';
2
- import type { Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
3
- import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
-
5
- export interface QRCodeNativeComponentProps extends ViewProps {
6
- code: string;
7
- size: Int32;
8
- ratio?: Double;
9
- }
10
-
11
- export default codegenNativeComponent<QRCodeNativeComponentProps>('RCTQRCode');
@@ -1,14 +0,0 @@
1
- import type { HostComponent, ViewProps, Float, Int32 } from 'react-native';
2
- export interface BarCodeNativeComponentProps extends ViewProps {
3
- /** the data string to encode */
4
- code?: string;
5
- /** scale-factor for the raw CIImage */
6
- ratio?: Float;
7
- /** pixel width of the final barcode */
8
- width?: Int32;
9
- /** pixel height of the final barcode */
10
- height?: Int32;
11
- }
12
- declare const _default: HostComponent<BarCodeNativeComponentProps>;
13
- export default _default;
14
- //# sourceMappingURL=RCTBarCodeNativeComponent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RCTBarCodeNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/RCTBarCodeNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAG3E,MAAM,WAAW,2BAA4B,SAAQ,SAAS;IAC5D,gCAAgC;IAChC,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,10 +0,0 @@
1
- import type { ViewProps } from 'react-native';
2
- import type { Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
3
- export interface QRCodeNativeComponentProps extends ViewProps {
4
- code: string;
5
- size: Int32;
6
- ratio?: Double;
7
- }
8
- declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<QRCodeNativeComponentProps>;
9
- export default _default;
10
- //# sourceMappingURL=RCTQRCodeNativeComponent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RCTQRCodeNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/RCTQRCodeNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAG/E,MAAM,WAAW,0BAA2B,SAAQ,SAAS;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;;AAED,wBAA+E"}
@@ -1,14 +0,0 @@
1
- /**
2
- * @format
3
- */
4
- import type { ViewProps } from 'react-native';
5
- import type { Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
6
- import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
7
-
8
- export interface NativeProps extends ViewProps {
9
- code: string;
10
- size: Int32;
11
- ratio?: Double;
12
- }
13
-
14
- export default codegenNativeComponent<NativeProps>('RCTQRCode');