scandit-react-native-datacapture-core 8.2.1 → 8.3.0

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 (79) hide show
  1. package/android/build.gradle +20 -9
  2. package/android/generated/java/com/facebook/fbreact/specs/NativeScanditDataCaptureCoreSpec.java +83 -0
  3. package/android/generated/java/com/facebook/react/viewmanagers/RNTDataCaptureViewManagerDelegate.java +26 -0
  4. package/android/generated/java/com/facebook/react/viewmanagers/RNTDataCaptureViewManagerInterface.java +16 -0
  5. package/android/generated/jni/CMakeLists.txt +29 -0
  6. package/android/generated/jni/ScanditReactNativeDatacaptureCoreSpec-generated.cpp +52 -0
  7. package/android/generated/jni/ScanditReactNativeDatacaptureCoreSpec.h +31 -0
  8. package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/ComponentDescriptors.cpp +22 -0
  9. package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/ComponentDescriptors.h +24 -0
  10. package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/EventEmitters.cpp +16 -0
  11. package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/EventEmitters.h +23 -0
  12. package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/Props.cpp +25 -0
  13. package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/Props.h +27 -0
  14. package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/ScanditReactNativeDatacaptureCoreSpecJSI-generated.cpp +47 -0
  15. package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/ScanditReactNativeDatacaptureCoreSpecJSI.h +169 -0
  16. package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/ShadowNodes.cpp +17 -0
  17. package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/ShadowNodes.h +32 -0
  18. package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/States.cpp +16 -0
  19. package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/States.h +29 -0
  20. package/android/src/main/AndroidManifest.xml +3 -1
  21. package/android/src/main/AndroidManifestNew.xml +3 -1
  22. package/android/src/main/kotlin/com/scandit/datacapture/reactnative/core/{ScanditDataCaptureCoreModule.kt → ScanditDataCaptureCoreModuleBase.kt} +15 -40
  23. package/android/src/main/kotlin/com/scandit/datacapture/reactnative/core/ScanditDataCaptureCorePackage.kt +1 -23
  24. package/android/src/main/kotlin/com/scandit/datacapture/reactnative/core/ui/{DataCaptureViewManager.kt → DataCaptureViewManagerBase.kt} +9 -4
  25. package/android/src/main/newArch/kotlin/com/scandit/datacapture/reactnative/core/ScanditDataCaptureCoreModule.kt +72 -0
  26. package/android/src/main/newArch/kotlin/com/scandit/datacapture/reactnative/core/ScanditReactPackageBase.kt +44 -11
  27. package/android/src/main/newArch/kotlin/com/scandit/datacapture/reactnative/core/ui/DataCaptureViewManager.kt +31 -0
  28. package/android/src/main/newArch/kotlin/com/scandit/datacapture/reactnative/core/utils/ReactNativeEventEmitter.kt +39 -0
  29. package/android/src/main/oldArch/kotlin/com/scandit/datacapture/reactnative/core/ScanditDataCaptureCoreModule.kt +86 -0
  30. package/android/src/main/oldArch/kotlin/com/scandit/datacapture/reactnative/core/ScanditReactPackageBase.kt +2 -2
  31. package/android/src/main/oldArch/kotlin/com/scandit/datacapture/reactnative/core/ui/DataCaptureViewManager.kt +18 -0
  32. package/android/src/main/{kotlin → oldArch/kotlin}/com/scandit/datacapture/reactnative/core/utils/ReactNativeEventEmitter.kt +4 -1
  33. package/dist/core.js +871 -69
  34. package/dist/core.js.map +1 -1
  35. package/dist/dts/DataCaptureView.d.ts +3 -0
  36. package/dist/dts/index.d.ts +79 -13
  37. package/dist/dts/native/RNNativeCaller.d.ts +8 -1
  38. package/dist/index.js +44 -7
  39. package/dist/index.js.flow +79 -99
  40. package/dist/index.js.map +1 -1
  41. package/dist/tsconfig.tsbuildinfo +1 -1
  42. package/ios/Sources/NewArch/RCTDataCaptureView.mm +110 -0
  43. package/ios/Sources/NewArch/ScanditDataCaptureCore.mm +102 -0
  44. package/ios/Sources/OldArch/RCTFabricDataCaptureViewContainers.mm +17 -0
  45. package/ios/Sources/OldArch/ScanditDataCaptureCore.mm +92 -0
  46. package/ios/Sources/RNTSDCDataCaptureViewManager.swift +41 -0
  47. package/ios/Sources/SDCLogger.h +11 -0
  48. package/ios/Sources/SDCLogger.m +16 -0
  49. package/ios/Sources/SDCTurboModuleEventBridge.h +42 -0
  50. package/ios/Sources/SDCTurboModuleEventBridge.m +20 -0
  51. package/ios/Sources/ScanditDataCaptureCore-Bridging-Header.h +3 -0
  52. package/ios/Sources/ScanditDataCaptureCore.h +35 -1
  53. package/ios/Sources/ScanditDataCaptureCore.swift +134 -60
  54. package/ios/Sources/Shared/DataCaptureViewWrapper.swift +129 -0
  55. package/ios/Sources/{Protocols → Shared}/ScanditReactNativeFactoryContainer.swift +7 -3
  56. package/ios/Sources/Utils/CallbackLock.swift +1 -1
  57. package/ios/Sources/Utils/ReactNativeEmitter.swift +43 -10
  58. package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/ComponentDescriptors.cpp +22 -0
  59. package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/ComponentDescriptors.h +24 -0
  60. package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/EventEmitters.cpp +16 -0
  61. package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/EventEmitters.h +23 -0
  62. package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/Props.cpp +25 -0
  63. package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/Props.h +27 -0
  64. package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/RCTComponentViewHelpers.h +20 -0
  65. package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/ScanditReactNativeDatacaptureCoreSpec-generated.mm +67 -0
  66. package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/ScanditReactNativeDatacaptureCoreSpec.h +109 -0
  67. package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/ShadowNodes.cpp +17 -0
  68. package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/ShadowNodes.h +32 -0
  69. package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/States.cpp +16 -0
  70. package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/States.h +29 -0
  71. package/ios/generated/ScanditReactNativeDatacaptureCoreSpecJSI-generated.cpp +47 -0
  72. package/ios/generated/ScanditReactNativeDatacaptureCoreSpecJSI.h +169 -0
  73. package/package.json +26 -7
  74. package/react-native.config.js +12 -0
  75. package/scandit-react-native-datacapture-core.podspec +49 -17
  76. package/specs/NativeScanditDataCaptureCore.ts +36 -0
  77. package/specs/RNTDataCaptureViewNativeComponent.ts +14 -0
  78. package/ios/Sources/ScanditDataCaptureCore.m +0 -30
  79. package/ios/Sources/ScanditDataCaptureViewManager.swift +0 -68
@@ -0,0 +1,36 @@
1
+ import {TurboModule, TurboModuleRegistry} from 'react-native';
2
+ import type {EventEmitter} from 'react-native/Libraries/Types/CodegenTypes';
3
+
4
+ /**
5
+ * Unified event payload for all Scandit events.
6
+ * Events are filtered by name on the JS side.
7
+ */
8
+ export type ScanditEventPayload = {
9
+ name: string;
10
+ data: string;
11
+ viewId?: number;
12
+ modeId?: number;
13
+ };
14
+
15
+ export interface Spec extends TurboModule {
16
+ readonly getConstants: () => {
17
+ // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
18
+ Defaults: Object;
19
+ };
20
+
21
+ // Events - unified event emitter for all Core events
22
+ readonly onScanditEvent: EventEmitter<ScanditEventPayload>;
23
+
24
+ // View methods - use Object so codegen produces NSDictionary on iOS (see Codegen Typings appendix)
25
+ // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
26
+ createDataCaptureView(data: Object): Promise<void>;
27
+ // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
28
+ removeDataCaptureView(data: Object): Promise<void>;
29
+
30
+ // Single entry point for all Core operations - use Object so codegen produces NSDictionary on iOS
31
+ // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
32
+ executeCore(data: Object): Promise<void>;
33
+ }
34
+
35
+ export default TurboModuleRegistry.getEnforcing<Spec>('ScanditDataCaptureCore');
36
+
@@ -0,0 +1,14 @@
1
+ /*
2
+ * This file is part of the Scandit Data Capture SDK
3
+ *
4
+ * Copyright (C) 2026- Scandit AG. All rights reserved.
5
+ */
6
+
7
+ import { codegenNativeComponent, type HostComponent, type ViewProps } from 'react-native';
8
+
9
+
10
+ export interface NativeProps extends ViewProps {}
11
+
12
+ export default codegenNativeComponent<NativeProps>(
13
+ 'RNTDataCaptureView'
14
+ ) as HostComponent<NativeProps>;
@@ -1,30 +0,0 @@
1
- /*
2
- * This file is part of the Scandit Data Capture SDK
3
- *
4
- * Copyright (C) 2020- Scandit AG. All rights reserved.
5
- */
6
-
7
- #import <React/RCTEventEmitter.h>
8
- #import <React/RCTBridgeModule.h>
9
- #import <React/RCTLog.h>
10
- #import "ScanditDataCaptureCore.h"
11
-
12
- void inline LogWarn(NSString *message) { RCTLogWarn(@"%@", message); }
13
-
14
- @interface RCT_EXTERN_MODULE (ScanditDataCaptureCore, RCTEventEmitter)
15
-
16
- RCT_EXTERN_METHOD(executeCore
17
- : (NSDictionary *)data resolve
18
- : (RCTPromiseResolveBlock)resolve reject
19
- : (RCTPromiseRejectBlock)reject)
20
-
21
- RCT_EXTERN_METHOD(createDataCaptureView
22
- : (NSDictionary *)data resolve
23
- : (RCTPromiseResolveBlock)resolve reject
24
- : (RCTPromiseRejectBlock)reject)
25
-
26
- RCT_EXTERN_METHOD(removeDataCaptureView
27
- : (NSDictionary *)data resolve
28
- : (RCTPromiseResolveBlock)resolve reject
29
- : (RCTPromiseRejectBlock)reject)
30
- @end
@@ -1,68 +0,0 @@
1
- /*
2
- * This file is part of the Scandit Data Capture SDK
3
- *
4
- * Copyright (C) 2020- Scandit AG. All rights reserved.
5
- */
6
-
7
- import Foundation
8
- import React
9
- import ScanditFrameworksCore
10
-
11
- class RNTSDCDataCaptureViewWrapper: UIView {
12
- override func removeFromSuperview() {
13
- if let index = RNTSDCDataCaptureViewManager.containers.firstIndex(of: self) {
14
- dispatchMain {
15
- RNTSDCDataCaptureViewManager.containers.remove(at: index)
16
- }
17
- }
18
- if let droppedView = self.findFirstSubview(ofType: DataCaptureView.self) {
19
- // on iOS we don't have a callback like the android onDropViewInstance where we can remove the dropped instance.
20
- // here we just override the willRemoveSubview of the wrapper and notify the core module that the dcview has been removed.
21
- DeserializationLifeCycleDispatcher.shared.dispatchDataCaptureViewRemoved(view: droppedView)
22
- }
23
- super.removeFromSuperview()
24
- }
25
-
26
- public func findFirstSubview<T: UIView>(ofType type: T.Type) -> T? {
27
- self.subviews.first { $0 is T } as? T
28
- }
29
-
30
- override func didMoveToSuperview() {
31
- // When the container is added to the RN stack, we need to check if the container has a DCView or not
32
- if self.findFirstSubview(ofType: DataCaptureView.self) == nil {
33
- // In case no DCView was still added to the container, we need to check whether a DCView was already
34
- // created for this container and in case add the view here.
35
- if let frameworksDataCaptureView = DataCaptureViewHandler.shared.getView(self.reactTag.intValue) {
36
- guard let currentView = frameworksDataCaptureView.view else {
37
- return
38
- }
39
- currentView.frame = currentView.bounds
40
- currentView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
41
- self.addSubview(currentView)
42
- }
43
- }
44
- }
45
- }
46
-
47
- @objc(RNTSDCDataCaptureViewManager)
48
- class RNTSDCDataCaptureViewManager: RCTViewManager, DeserializationLifeCycleObserver {
49
-
50
- static var containers: [RNTSDCDataCaptureViewWrapper] = []
51
-
52
- override class func requiresMainQueueSetup() -> Bool {
53
- // Returning false prevents RCTUnsafeExecuteOnMainQueueSync from being called
54
- // during LegacyViewManagerInteropComponentDescriptor initialization in Fabric,
55
- // which can cause a deadlock when the main thread tries to acquire the
56
- // ComponentDescriptorRegistry mutex while the JS thread holds it.
57
- // See: https://github.com/facebook/react-native/issues/53128
58
- false
59
- }
60
-
61
- override func view() -> UIView! {
62
- let container = RNTSDCDataCaptureViewWrapper()
63
-
64
- RNTSDCDataCaptureViewManager.containers.append(container)
65
-
66
- return container
67
- }
68
- }