@react-native-ohos/react-native-qr-decode-image-camera 1.1.4-rc.2 → 1.1.5-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/README.md +1 -1
- package/harmony/qr_decode_image_camera/BuildProfile.ets +1 -1
- package/harmony/qr_decode_image_camera/Index.ets +3 -2
- package/harmony/qr_decode_image_camera/oh-package.json5 +1 -1
- package/harmony/qr_decode_image_camera/src/main/cpp/CMakeLists.txt +3 -2
- package/harmony/qr_decode_image_camera/src/main/cpp/QrDecodeImageCameraPackage.h +16 -10
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/RNOH/generated/BaseReactNativeQrDecodeImageCameraPackage.h +6 -8
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/RNOH/generated/components/NativeScanJSIBinder.h +30 -0
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/ComponentDescriptors.h +6 -8
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/EventEmitters.cpp +13 -3
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/EventEmitters.h +12 -2
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/Props.cpp +13 -3
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/Props.h +15 -2
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/ShadowNodes.cpp +6 -4
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/ShadowNodes.h +16 -5
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/States.cpp +5 -3
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/States.h +19 -2
- package/harmony/qr_decode_image_camera/src/main/ets/NativeScan.ets +1 -1
- package/harmony/qr_decode_image_camera/src/main/ets/{RNQrDecodeImageCameraPackage.ts → RNQrDecodeImageCameraPackage.ets} +2 -1
- package/harmony/qr_decode_image_camera/src/main/ets/generated/components/NativeScan.ts +1 -6
- package/harmony/qr_decode_image_camera/src/main/ets/generated/components/ts.ts +1 -4
- package/harmony/qr_decode_image_camera.har +0 -0
- package/package.json +17 -8
- package/src/QRScanner.harmony.jsx +2 -0
- package/src/QRScannerView.js +2 -3
- /package/harmony/qr_decode_image_camera/{ts.ts → ts.ets} +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @react-native-ohos/react-native-qr-decode-image-camera
|
|
2
2
|
|
|
3
|
-
This project is based on [react-native-qr-decode-image-camera
|
|
3
|
+
This project is based on [react-native-qr-decode-image-camera](https://github.com/deepanrajkumar/react-native-qr-decode-image-camera)@1.1.3
|
|
4
4
|
|
|
5
5
|
## Documentation URL
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Use these variables when you tailor your ArkTS code. They must be of the const type.
|
|
3
3
|
*/
|
|
4
|
-
export const HAR_VERSION = '1.
|
|
4
|
+
export const HAR_VERSION = '1.0.0-0.0.3';
|
|
5
5
|
export const BUILD_MODE_NAME = 'debug';
|
|
6
6
|
export const DEBUG = true;
|
|
7
7
|
export const TARGET_NAME = 'default';
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Use of this source code is governed by a MIT license that can be
|
|
4
4
|
* found in the LICENSE file.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
import {RNQrDecodeImageCameraPackage as QrDecodeImageCameraPackage } from './src/main/ets/RNQrDecodeImageCameraPackage';
|
|
7
7
|
export * from "./ts";
|
|
8
|
-
export * from "./src/main/ets/NativeScan"
|
|
8
|
+
export * from "./src/main/ets/NativeScan"
|
|
9
|
+
export default QrDecodeImageCameraPackage;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# the minimum version of CMake
|
|
1
2
|
cmake_minimum_required(VERSION 3.13)
|
|
2
3
|
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
3
4
|
|
|
@@ -5,5 +6,5 @@ set(rnoh_qr_decode_image_camera_generated_dir "${CMAKE_CURRENT_SOURCE_DIR}/gener
|
|
|
5
6
|
file(GLOB_RECURSE rnoh_qr_decode_image_camera_generated_SRC "${rnoh_qr_decode_image_camera_generated_dir}/**/*.cpp")
|
|
6
7
|
file(GLOB rnoh_qr_decode_image_camera_SRC CONFIGURE_DEPENDS *.cpp)
|
|
7
8
|
add_library(rnoh_qr_decode_image_camera SHARED ${rnoh_qr_decode_image_camera_SRC} ${rnoh_qr_decode_image_camera_generated_SRC})
|
|
8
|
-
target_include_directories(rnoh_qr_decode_image_camera PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${rnoh_qr_decode_image_camera_generated_dir}
|
|
9
|
-
target_link_libraries(rnoh_qr_decode_image_camera PUBLIC rnoh)
|
|
9
|
+
target_include_directories(rnoh_qr_decode_image_camera PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${rnoh_qr_decode_image_camera_generated_dir})
|
|
10
|
+
target_link_libraries( rnoh_qr_decode_image_camera PUBLIC rnoh)
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
3
|
+
* Licensed under the MIT License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* https://gitee.com/openharmony-sig/rntpc_react-native-qr-decode-image-camera
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
4
15
|
|
|
5
|
-
#ifndef QRDECODEIMAGECAMERAPACKAGE_H
|
|
6
|
-
#define QRDECODEIMAGECAMERAPACKAGE_H
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
#include "generated/RNOH/generated/BaseReactNativeQrDecodeImageCameraPackage.h"
|
|
10
16
|
#pragma once
|
|
11
17
|
|
|
18
|
+
#include "generated/RNOH/generated/BaseReactNativeQrDecodeImageCameraPackage.h"
|
|
12
19
|
|
|
13
20
|
namespace rnoh {
|
|
14
21
|
class QrDecodeImageCameraPackage : public BaseReactNativeQrDecodeImageCameraPackage {
|
|
15
22
|
using Super = BaseReactNativeQrDecodeImageCameraPackage;
|
|
16
23
|
using Super::Super;
|
|
17
24
|
};
|
|
18
|
-
} // namespace rnoh
|
|
19
|
-
#endif //QRDECODEIMAGECAMERAPACKAGE_H
|
|
25
|
+
} // namespace rnoh
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
#pragma once
|
|
6
6
|
|
|
7
|
+
#include <react/renderer/components/react_native_qr_decode_image_camera/ComponentDescriptors.h>
|
|
7
8
|
#include "RNOH/Package.h"
|
|
8
9
|
#include "RNOH/ArkTSTurboModule.h"
|
|
9
10
|
#include "RNOH/generated/turbo_modules/QrDecodeImageCameraNativeModule.h"
|
|
11
|
+
#include "RNOH/generated/components/NativeScanJSIBinder.h"
|
|
10
12
|
|
|
11
13
|
namespace rnoh {
|
|
12
14
|
|
|
@@ -24,20 +26,14 @@ class BaseReactNativeQrDecodeImageCameraPackageEventEmitRequestHandler : public
|
|
|
24
26
|
public:
|
|
25
27
|
void handleEvent(Context const &ctx) override {
|
|
26
28
|
auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
|
|
27
|
-
auto componentName = ctx.shadowViewRegistry->getComponentName(ctx.tag);
|
|
28
|
-
|
|
29
29
|
if (eventEmitter == nullptr) {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
std::vector<std::string> supportedComponentNames = {
|
|
34
|
-
};
|
|
35
|
-
|
|
36
33
|
std::vector<std::string> supportedEventNames = {
|
|
34
|
+
"read",
|
|
37
35
|
};
|
|
38
|
-
|
|
39
|
-
if (std::find(supportedComponentNames.begin(), supportedComponentNames.end(), componentName) != supportedComponentNames.end() &&
|
|
40
|
-
std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
|
|
36
|
+
if (std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
|
|
41
37
|
eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
|
|
42
38
|
}
|
|
43
39
|
}
|
|
@@ -54,11 +50,13 @@ class BaseReactNativeQrDecodeImageCameraPackage : public Package {
|
|
|
54
50
|
|
|
55
51
|
std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override {
|
|
56
52
|
return {
|
|
53
|
+
facebook::react::concreteComponentDescriptorProvider<facebook::react::NativeScanComponentDescriptor>(),
|
|
57
54
|
};
|
|
58
55
|
}
|
|
59
56
|
|
|
60
57
|
ComponentJSIBinderByString createComponentJSIBinderByName() override {
|
|
61
58
|
return {
|
|
59
|
+
{"NativeScan", std::make_shared<NativeScanJSIBinder>()},
|
|
62
60
|
};
|
|
63
61
|
};
|
|
64
62
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
#include "RNOHCorePackage/ComponentBinders/ViewComponentJSIBinder.h"
|
|
7
|
+
|
|
8
|
+
namespace rnoh {
|
|
9
|
+
class NativeScanJSIBinder : public ViewComponentJSIBinder {
|
|
10
|
+
protected:
|
|
11
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
|
12
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
|
13
|
+
object.setProperty(rt, "text", true);
|
|
14
|
+
object.setProperty(rt, "flashMode", true);
|
|
15
|
+
object.setProperty(rt, "zoom", true);
|
|
16
|
+
return object;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
|
|
20
|
+
facebook::jsi::Object events(rt);
|
|
21
|
+
events.setProperty(rt, "topRead", createBubblingCapturedEvent(rt, "onRead"));
|
|
22
|
+
return events;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
|
26
|
+
facebook::jsi::Object events(rt);
|
|
27
|
+
return events;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
} // namespace rnoh
|
|
@@ -10,15 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
#pragma once
|
|
12
12
|
|
|
13
|
-
#include
|
|
13
|
+
#include <react/renderer/components/react_native_qr_decode_image_camera/ShadowNodes.h>
|
|
14
14
|
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
-
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
16
15
|
|
|
17
|
-
namespace facebook
|
|
16
|
+
namespace facebook {
|
|
17
|
+
namespace react {
|
|
18
18
|
|
|
19
|
+
using NativeScanComponentDescriptor = ConcreteComponentDescriptor<NativeScanShadowNode>;
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
|
23
|
-
|
|
24
|
-
} // namespace facebook::react
|
|
21
|
+
} // namespace react
|
|
22
|
+
} // namespace facebook
|
|
@@ -8,9 +8,19 @@
|
|
|
8
8
|
* @generated by codegen project: GenerateEventEmitterCpp.js
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
#include
|
|
11
|
+
#include <react/renderer/components/react_native_qr_decode_image_camera/EventEmitters.h>
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
namespace facebook
|
|
14
|
+
namespace facebook {
|
|
15
|
+
namespace react {
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
void NativeScanEventEmitter::onRead(OnRead $event) const {
|
|
18
|
+
dispatchEvent("read", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
19
|
+
auto $payload = jsi::Object(runtime);
|
|
20
|
+
$payload.setProperty(runtime, "result", $event.result);
|
|
21
|
+
return $payload;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
} // namespace react
|
|
26
|
+
} // namespace facebook
|
|
@@ -12,6 +12,16 @@
|
|
|
12
12
|
#include <react/renderer/components/view/ViewEventEmitter.h>
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
namespace facebook
|
|
15
|
+
namespace facebook {
|
|
16
|
+
namespace react {
|
|
17
|
+
class NativeScanEventEmitter : public ViewEventEmitter {
|
|
18
|
+
public:
|
|
19
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
struct OnRead {
|
|
22
|
+
std::string result;
|
|
23
|
+
};
|
|
24
|
+
void onRead(OnRead value) const;
|
|
25
|
+
};
|
|
26
|
+
} // namespace react
|
|
27
|
+
} // namespace facebook
|
|
@@ -8,12 +8,22 @@
|
|
|
8
8
|
* @generated by codegen project: GeneratePropsCpp.js
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
#include
|
|
11
|
+
#include <react/renderer/components/react_native_qr_decode_image_camera/Props.h>
|
|
12
12
|
#include <react/renderer/core/PropsParserContext.h>
|
|
13
13
|
#include <react/renderer/core/propsConversions.h>
|
|
14
14
|
|
|
15
|
-
namespace facebook
|
|
15
|
+
namespace facebook {
|
|
16
|
+
namespace react {
|
|
16
17
|
|
|
18
|
+
NativeScanProps::NativeScanProps(
|
|
19
|
+
const PropsParserContext &context,
|
|
20
|
+
const NativeScanProps &sourceProps,
|
|
21
|
+
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
17
22
|
|
|
23
|
+
text(convertRawProp(context, rawProps, "text", sourceProps.text, {})),
|
|
24
|
+
flashMode(convertRawProp(context, rawProps, "flashMode", sourceProps.flashMode, {false})),
|
|
25
|
+
zoom(convertRawProp(context, rawProps, "zoom", sourceProps.zoom, {0.0}))
|
|
26
|
+
{}
|
|
18
27
|
|
|
19
|
-
} // namespace
|
|
28
|
+
} // namespace react
|
|
29
|
+
} // namespace facebook
|
|
@@ -9,10 +9,23 @@
|
|
|
9
9
|
*/
|
|
10
10
|
#pragma once
|
|
11
11
|
|
|
12
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
13
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
12
14
|
|
|
15
|
+
namespace facebook {
|
|
16
|
+
namespace react {
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
class NativeScanProps final : public ViewProps {
|
|
19
|
+
public:
|
|
20
|
+
NativeScanProps() = default;
|
|
21
|
+
NativeScanProps(const PropsParserContext& context, const NativeScanProps &sourceProps, const RawProps &rawProps);
|
|
15
22
|
|
|
23
|
+
#pragma mark - Props
|
|
16
24
|
|
|
25
|
+
std::string text{};
|
|
26
|
+
bool flashMode{false};
|
|
27
|
+
Float zoom{0.0};
|
|
28
|
+
};
|
|
17
29
|
|
|
18
|
-
} // namespace
|
|
30
|
+
} // namespace react
|
|
31
|
+
} // namespace facebook
|
|
@@ -8,10 +8,12 @@
|
|
|
8
8
|
* @generated by codegen project: GenerateShadowNodeCpp.js
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
#include
|
|
11
|
+
#include <react/renderer/components/react_native_qr_decode_image_camera/ShadowNodes.h>
|
|
12
12
|
|
|
13
|
-
namespace facebook
|
|
13
|
+
namespace facebook {
|
|
14
|
+
namespace react {
|
|
14
15
|
|
|
16
|
+
extern const char NativeScanComponentName[] = "NativeScan";
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
} // namespace facebook
|
|
18
|
+
} // namespace react
|
|
19
|
+
} // namespace facebook
|
|
@@ -10,14 +10,25 @@
|
|
|
10
10
|
|
|
11
11
|
#pragma once
|
|
12
12
|
|
|
13
|
-
#include
|
|
14
|
-
#include
|
|
15
|
-
#include
|
|
13
|
+
#include <react/renderer/components/react_native_qr_decode_image_camera/EventEmitters.h>
|
|
14
|
+
#include <react/renderer/components/react_native_qr_decode_image_camera/Props.h>
|
|
15
|
+
#include <react/renderer/components/react_native_qr_decode_image_camera/States.h>
|
|
16
16
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
17
|
#include <jsi/jsi.h>
|
|
18
18
|
|
|
19
|
-
namespace facebook
|
|
19
|
+
namespace facebook {
|
|
20
|
+
namespace react {
|
|
20
21
|
|
|
22
|
+
JSI_EXPORT extern const char NativeScanComponentName[];
|
|
21
23
|
|
|
24
|
+
/*
|
|
25
|
+
* `ShadowNode` for <NativeScan> component.
|
|
26
|
+
*/
|
|
27
|
+
using NativeScanShadowNode = ConcreteViewShadowNode<
|
|
28
|
+
NativeScanComponentName,
|
|
29
|
+
NativeScanProps,
|
|
30
|
+
NativeScanEventEmitter,
|
|
31
|
+
NativeScanState>;
|
|
22
32
|
|
|
23
|
-
} // namespace
|
|
33
|
+
} // namespace react
|
|
34
|
+
} // namespace facebook
|
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @generated by codegen project: GenerateStateCpp.js
|
|
9
9
|
*/
|
|
10
|
-
#include
|
|
10
|
+
#include <react/renderer/components/react_native_qr_decode_image_camera/States.h>
|
|
11
11
|
|
|
12
|
-
namespace facebook
|
|
12
|
+
namespace facebook {
|
|
13
|
+
namespace react {
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
} // namespace
|
|
17
|
+
} // namespace react
|
|
18
|
+
} // namespace facebook
|
|
@@ -10,10 +10,27 @@
|
|
|
10
10
|
|
|
11
11
|
#ifdef ANDROID
|
|
12
12
|
#include <folly/dynamic.h>
|
|
13
|
+
#include <react/renderer/mapbuffer/MapBuffer.h>
|
|
14
|
+
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
|
13
15
|
#endif
|
|
14
16
|
|
|
15
|
-
namespace facebook
|
|
17
|
+
namespace facebook {
|
|
18
|
+
namespace react {
|
|
16
19
|
|
|
20
|
+
class NativeScanState {
|
|
21
|
+
public:
|
|
22
|
+
NativeScanState() = default;
|
|
17
23
|
|
|
24
|
+
#ifdef ANDROID
|
|
25
|
+
NativeScanState(NativeScanState const &previousState, folly::dynamic data){};
|
|
26
|
+
folly::dynamic getDynamic() const {
|
|
27
|
+
return {};
|
|
28
|
+
};
|
|
29
|
+
MapBuffer getMapBuffer() const {
|
|
30
|
+
return MapBufferBuilder::EMPTY();
|
|
31
|
+
};
|
|
32
|
+
#endif
|
|
33
|
+
};
|
|
18
34
|
|
|
19
|
-
} // namespace
|
|
35
|
+
} // namespace react
|
|
36
|
+
} // namespace facebook
|
|
@@ -20,7 +20,7 @@ interface NativeScanProps extends ViewBaseProps {
|
|
|
20
20
|
export type NativeScanDescriptor = Descriptor<"NativeScan", NativeScanProps>
|
|
21
21
|
@Component
|
|
22
22
|
export struct NativeScan {
|
|
23
|
-
public static readonly NAME
|
|
23
|
+
public static readonly NAME = RNC.NativeScan.NAME
|
|
24
24
|
public ctx!: RNOHContext
|
|
25
25
|
public tag: number = 0
|
|
26
26
|
@State @Watch("changeProps") descriptor: NativeScanDescriptor = {} as NativeScanDescriptor //监听闪光灯
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
|
|
8
8
|
import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
|
|
9
|
+
import { RNOHPackage } from '@rnoh/react-native-openharmony'
|
|
9
10
|
import { TM } from './generated/ts'
|
|
10
11
|
import { RNQrDecodeImageCameraTurboModule } from './RNQrDecodeImageCameraTurboModule';
|
|
11
12
|
|
|
@@ -22,7 +23,7 @@ class RNQrDecodeImageCameraTurboModuleFactory extends TurboModulesFactory {
|
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
export class RNQrDecodeImageCameraPackage extends
|
|
26
|
+
export class RNQrDecodeImageCameraPackage extends RNOHPackage {
|
|
26
27
|
createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
|
|
27
28
|
return new RNQrDecodeImageCameraTurboModuleFactory(ctx);
|
|
28
29
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This code was generated by "react-native codegen-harmony"
|
|
3
|
-
*
|
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
-
* lost once the code is regenerated.
|
|
6
|
-
*
|
|
7
|
-
* @generatorVersion: 1
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
8
3
|
*/
|
|
9
4
|
|
|
10
5
|
import {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This code was generated by "react-native codegen-harmony"
|
|
3
|
-
*
|
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
-
* lost once the code is regenerated.
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
6
3
|
*/
|
|
7
4
|
|
|
8
5
|
export * from "./NativeScan"
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-ohos/react-native-qr-decode-image-camera",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5-rc.1",
|
|
4
4
|
"description": "Decode react native from gallery and camera",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"nativePackage": true,
|
|
8
8
|
"scripts": {
|
|
9
9
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
10
|
-
"codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-qr-decode-image-camera --cpp-output-path ./harmony/qr_decode_image_camera/src/main/cpp/generated --ets-output-path ./harmony/qr_decode_image_camera/src/main/ets/generated --turbo-modules-spec-paths ./src/NativeQrDecodeImageCamera.ts"
|
|
10
|
+
"codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-qr-decode-image-camera --cpp-output-path ./harmony/qr_decode_image_camera/src/main/cpp/generated --ets-output-path ./harmony/qr_decode_image_camera/src/main/ets/generated --turbo-modules-spec-paths ./src/NativeQrDecodeImageCamera.ts --arkts-components-spec-paths ./src"
|
|
11
11
|
},
|
|
12
12
|
"harmony": {
|
|
13
|
-
"alias": "react-native-qr-decode-image-camera"
|
|
13
|
+
"alias": "react-native-qr-decode-image-camera",
|
|
14
|
+
"autolinking": {
|
|
15
|
+
"etsPackageClassName":"QrDecodeImageCameraPackage",
|
|
16
|
+
"cppPackageClassName":"QrDecodeImageCameraPackage",
|
|
17
|
+
"cmakeLibraryTargetName": "rnoh_qr_decode_image_camera",
|
|
18
|
+
"ohPackageName": "@react-native-ohos/react-native-qr-decode-image-camera"
|
|
19
|
+
}
|
|
14
20
|
},
|
|
15
21
|
"keywords": [
|
|
16
22
|
"QRCode",
|
|
@@ -21,11 +27,9 @@
|
|
|
21
27
|
],
|
|
22
28
|
"dependencies": {
|
|
23
29
|
"prop-types": "^15.8.1",
|
|
24
|
-
"react-native-qr-decode-image-camera":"^1.1.3"
|
|
25
|
-
"react-native": "0.72.2",
|
|
26
|
-
"@react-native-oh/react-native-harmony-cli": "npm:@react-native-oh/react-native-harmony-cli@^0.0.27"
|
|
30
|
+
"react-native-qr-decode-image-camera":"^1.1.3"
|
|
27
31
|
},
|
|
28
|
-
"homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-qr-decode-image-camera
|
|
32
|
+
"homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-qr-decode-image-camera",
|
|
29
33
|
"repository": {
|
|
30
34
|
"type": "git",
|
|
31
35
|
"url": "https://gitcode.com/openharmony-sig/rntpc_react-native-qr-decode-image-camera.git"
|
|
@@ -35,5 +39,10 @@
|
|
|
35
39
|
"react-native": "^0.69.0",
|
|
36
40
|
"react-native-vision-camera":"^4.0.1",
|
|
37
41
|
"react-native-qr-decode-image-camera":"^1.1.3"
|
|
38
|
-
}
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"registry": "https://registry.npmjs.org/",
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"author": "deepanrajkumar"
|
|
39
48
|
}
|
|
@@ -137,6 +137,7 @@ export default class QRScannerHarmony extends Component {
|
|
|
137
137
|
if (this.props.isRepeatScan) {
|
|
138
138
|
if (this.newValue !== this.oldValue) {
|
|
139
139
|
this.oldValue = this.newValue;
|
|
140
|
+
this.setState({ isActive: true });
|
|
140
141
|
Vibration.vibrate();
|
|
141
142
|
this.props.onRead(e);
|
|
142
143
|
}
|
|
@@ -144,6 +145,7 @@ export default class QRScannerHarmony extends Component {
|
|
|
144
145
|
} else {
|
|
145
146
|
if (!this.isShowCode) {
|
|
146
147
|
this.isShowCode = true;
|
|
148
|
+
this.setState({ isActive: false });
|
|
147
149
|
Vibration.vibrate();
|
|
148
150
|
this.props.onRead(e);
|
|
149
151
|
}
|
package/src/QRScannerView.js
CHANGED
|
@@ -208,8 +208,7 @@ export default class QRScannerView extends Component {
|
|
|
208
208
|
style={[
|
|
209
209
|
this.getBorderSize(),
|
|
210
210
|
this.getBorderColor(),
|
|
211
|
-
this.getBorderWidth()
|
|
212
|
-
{ overflow: 'hidden' }
|
|
211
|
+
this.getBorderWidth()
|
|
213
212
|
]}>
|
|
214
213
|
|
|
215
214
|
<Animated.View style={[animatedStyle]}>
|
|
@@ -322,7 +321,7 @@ export default class QRScannerView extends Component {
|
|
|
322
321
|
this.state.animatedValue.setValue(0); //重置Rotate动画值为0
|
|
323
322
|
Animated.timing(
|
|
324
323
|
this.state.animatedValue,
|
|
325
|
-
{toValue: this.props.rectHeight
|
|
324
|
+
{toValue: this.props.rectHeight,
|
|
326
325
|
duration: this.props.scanBarAnimateTime,
|
|
327
326
|
easing: Easing.linear,
|
|
328
327
|
useNativeDriver: true
|
|
File without changes
|