@react-native-ohos/react-native-qr-decode-image-camera 1.1.5-rc.2 → 1.2.0-rc.2
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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/harmony/qr_decode_image_camera/BuildProfile.ets +1 -1
- package/harmony/qr_decode_image_camera/Index.ets +2 -3
- package/harmony/qr_decode_image_camera/oh-package.json5 +1 -1
- package/harmony/qr_decode_image_camera/src/main/cpp/CMakeLists.txt +2 -3
- package/harmony/qr_decode_image_camera/src/main/cpp/QrDecodeImageCameraPackage.h +10 -16
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/RNOH/generated/BaseReactNativeQrDecodeImageCameraPackage.h +8 -6
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/ComponentDescriptors.h +8 -6
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/EventEmitters.cpp +3 -13
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/EventEmitters.h +2 -12
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/Props.cpp +3 -13
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/Props.h +2 -15
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/ShadowNodes.cpp +4 -6
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/ShadowNodes.h +5 -16
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/States.cpp +3 -5
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/States.h +2 -19
- package/harmony/qr_decode_image_camera/src/main/ets/NativeScan.ets +1 -1
- package/harmony/qr_decode_image_camera/src/main/ets/{RNQrDecodeImageCameraPackage.ets → RNQrDecodeImageCameraPackage.ts} +1 -2
- package/harmony/qr_decode_image_camera/src/main/ets/generated/components/NativeScan.ts +6 -1
- package/harmony/qr_decode_image_camera/src/main/ets/generated/components/ts.ts +4 -1
- package/harmony/qr_decode_image_camera.har +0 -0
- package/package.json +8 -17
- package/src/Camera.tsx +3 -1
- package/src/QRScanner.harmony.jsx +0 -2
- package/src/QRScannerView.js +3 -2
- package/harmony/qr_decode_image_camera/src/main/cpp/generated/RNOH/generated/components/NativeScanJSIBinder.h +0 -30
- /package/harmony/qr_decode_image_camera/{ts.ets → ts.ts} +0 -0
package/CHANGELOG.md
ADDED
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](https://github.com/deepanrajkumar/react-native-qr-decode-image-camera)
|
|
3
|
+
This project is based on [react-native-qr-decode-image-camera@1.1.3](https://github.com/deepanrajkumar/react-native-qr-decode-image-camera)
|
|
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.2.0-rc.1';
|
|
5
5
|
export const BUILD_MODE_NAME = 'debug';
|
|
6
6
|
export const DEBUG = true;
|
|
7
7
|
export const TARGET_NAME = 'default';
|
|
@@ -3,7 +3,6 @@
|
|
|
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
|
+
|
|
7
7
|
export * from "./ts";
|
|
8
|
-
export * from "./src/main/ets/NativeScan"
|
|
9
|
-
export default QrDecodeImageCameraPackage;
|
|
8
|
+
export * from "./src/main/ets/NativeScan"
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# the minimum version of CMake
|
|
2
1
|
cmake_minimum_required(VERSION 3.13)
|
|
3
2
|
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
4
3
|
|
|
@@ -6,5 +5,5 @@ set(rnoh_qr_decode_image_camera_generated_dir "${CMAKE_CURRENT_SOURCE_DIR}/gener
|
|
|
6
5
|
file(GLOB_RECURSE rnoh_qr_decode_image_camera_generated_SRC "${rnoh_qr_decode_image_camera_generated_dir}/**/*.cpp")
|
|
7
6
|
file(GLOB rnoh_qr_decode_image_camera_SRC CONFIGURE_DEPENDS *.cpp)
|
|
8
7
|
add_library(rnoh_qr_decode_image_camera SHARED ${rnoh_qr_decode_image_camera_SRC} ${rnoh_qr_decode_image_camera_generated_SRC})
|
|
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(
|
|
8
|
+
target_include_directories(rnoh_qr_decode_image_camera PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${rnoh_qr_decode_image_camera_generated_dir} ${CMAKE_CURRENT_SOURCE_DIR}/generated/RNOH/generated)
|
|
9
|
+
target_link_libraries(rnoh_qr_decode_image_camera PUBLIC rnoh)
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
*/
|
|
1
|
+
// Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a MIT license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
#ifndef QRDECODEIMAGECAMERAPACKAGE_H
|
|
6
|
+
#define QRDECODEIMAGECAMERAPACKAGE_H
|
|
15
7
|
|
|
16
|
-
#pragma once
|
|
17
8
|
|
|
18
9
|
#include "generated/RNOH/generated/BaseReactNativeQrDecodeImageCameraPackage.h"
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
19
12
|
|
|
20
13
|
namespace rnoh {
|
|
21
14
|
class QrDecodeImageCameraPackage : public BaseReactNativeQrDecodeImageCameraPackage {
|
|
22
15
|
using Super = BaseReactNativeQrDecodeImageCameraPackage;
|
|
23
16
|
using Super::Super;
|
|
24
17
|
};
|
|
25
|
-
} // namespace rnoh
|
|
18
|
+
} // namespace rnoh
|
|
19
|
+
#endif //QRDECODEIMAGECAMERAPACKAGE_H
|
|
@@ -4,11 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
#pragma once
|
|
6
6
|
|
|
7
|
-
#include <react/renderer/components/react_native_qr_decode_image_camera/ComponentDescriptors.h>
|
|
8
7
|
#include "RNOH/Package.h"
|
|
9
8
|
#include "RNOH/ArkTSTurboModule.h"
|
|
10
9
|
#include "RNOH/generated/turbo_modules/QrDecodeImageCameraNativeModule.h"
|
|
11
|
-
#include "RNOH/generated/components/NativeScanJSIBinder.h"
|
|
12
10
|
|
|
13
11
|
namespace rnoh {
|
|
14
12
|
|
|
@@ -26,14 +24,20 @@ class BaseReactNativeQrDecodeImageCameraPackageEventEmitRequestHandler : public
|
|
|
26
24
|
public:
|
|
27
25
|
void handleEvent(Context const &ctx) override {
|
|
28
26
|
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
|
+
|
|
33
36
|
std::vector<std::string> supportedEventNames = {
|
|
34
|
-
"read",
|
|
35
37
|
};
|
|
36
|
-
|
|
38
|
+
|
|
39
|
+
if (std::find(supportedComponentNames.begin(), supportedComponentNames.end(), componentName) != supportedComponentNames.end() &&
|
|
40
|
+
std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
|
|
37
41
|
eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
|
|
38
42
|
}
|
|
39
43
|
}
|
|
@@ -50,13 +54,11 @@ class BaseReactNativeQrDecodeImageCameraPackage : public Package {
|
|
|
50
54
|
|
|
51
55
|
std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override {
|
|
52
56
|
return {
|
|
53
|
-
facebook::react::concreteComponentDescriptorProvider<facebook::react::NativeScanComponentDescriptor>(),
|
|
54
57
|
};
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
ComponentJSIBinderByString createComponentJSIBinderByName() override {
|
|
58
61
|
return {
|
|
59
|
-
{"NativeScan", std::make_shared<NativeScanJSIBinder>()},
|
|
60
62
|
};
|
|
61
63
|
};
|
|
62
64
|
|
|
@@ -10,13 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
#pragma once
|
|
12
12
|
|
|
13
|
-
#include
|
|
13
|
+
#include "ShadowNodes.h"
|
|
14
14
|
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
15
16
|
|
|
16
|
-
namespace facebook {
|
|
17
|
-
namespace react {
|
|
17
|
+
namespace facebook::react {
|
|
18
18
|
|
|
19
|
-
using NativeScanComponentDescriptor = ConcreteComponentDescriptor<NativeScanShadowNode>;
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
|
|
21
|
+
void react_native_qr_decode_image_camera_registerComponentDescriptorsFromCodegen(
|
|
22
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
|
23
|
+
|
|
24
|
+
} // namespace facebook::react
|
|
@@ -8,19 +8,9 @@
|
|
|
8
8
|
* @generated by codegen project: GenerateEventEmitterCpp.js
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
#include
|
|
11
|
+
#include "EventEmitters.h"
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
namespace facebook {
|
|
15
|
-
namespace react {
|
|
14
|
+
namespace facebook::react {
|
|
16
15
|
|
|
17
|
-
|
|
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
|
|
16
|
+
} // namespace facebook::react
|
|
@@ -12,16 +12,6 @@
|
|
|
12
12
|
#include <react/renderer/components/view/ViewEventEmitter.h>
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
namespace facebook {
|
|
16
|
-
namespace react {
|
|
17
|
-
class NativeScanEventEmitter : public ViewEventEmitter {
|
|
18
|
-
public:
|
|
19
|
-
using ViewEventEmitter::ViewEventEmitter;
|
|
15
|
+
namespace facebook::react {
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
std::string result;
|
|
23
|
-
};
|
|
24
|
-
void onRead(OnRead value) const;
|
|
25
|
-
};
|
|
26
|
-
} // namespace react
|
|
27
|
-
} // namespace facebook
|
|
17
|
+
} // namespace facebook::react
|
|
@@ -8,22 +8,12 @@
|
|
|
8
8
|
* @generated by codegen project: GeneratePropsCpp.js
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
#include
|
|
11
|
+
#include "Props.h"
|
|
12
12
|
#include <react/renderer/core/PropsParserContext.h>
|
|
13
13
|
#include <react/renderer/core/propsConversions.h>
|
|
14
14
|
|
|
15
|
-
namespace facebook {
|
|
16
|
-
namespace react {
|
|
15
|
+
namespace facebook::react {
|
|
17
16
|
|
|
18
|
-
NativeScanProps::NativeScanProps(
|
|
19
|
-
const PropsParserContext &context,
|
|
20
|
-
const NativeScanProps &sourceProps,
|
|
21
|
-
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
22
17
|
|
|
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
|
-
{}
|
|
27
18
|
|
|
28
|
-
} // namespace react
|
|
29
|
-
} // namespace facebook
|
|
19
|
+
} // namespace facebook::react
|
|
@@ -9,23 +9,10 @@
|
|
|
9
9
|
*/
|
|
10
10
|
#pragma once
|
|
11
11
|
|
|
12
|
-
#include <react/renderer/components/view/ViewProps.h>
|
|
13
|
-
#include <react/renderer/core/PropsParserContext.h>
|
|
14
12
|
|
|
15
|
-
namespace facebook {
|
|
16
|
-
namespace react {
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
public:
|
|
20
|
-
NativeScanProps() = default;
|
|
21
|
-
NativeScanProps(const PropsParserContext& context, const NativeScanProps &sourceProps, const RawProps &rawProps);
|
|
14
|
+
namespace facebook::react {
|
|
22
15
|
|
|
23
|
-
#pragma mark - Props
|
|
24
16
|
|
|
25
|
-
std::string text{};
|
|
26
|
-
bool flashMode{false};
|
|
27
|
-
Float zoom{0.0};
|
|
28
|
-
};
|
|
29
17
|
|
|
30
|
-
} // namespace react
|
|
31
|
-
} // namespace facebook
|
|
18
|
+
} // namespace facebook::react
|
|
@@ -8,12 +8,10 @@
|
|
|
8
8
|
* @generated by codegen project: GenerateShadowNodeCpp.js
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
#include
|
|
11
|
+
#include "ShadowNodes.h"
|
|
12
12
|
|
|
13
|
-
namespace facebook {
|
|
14
|
-
namespace react {
|
|
13
|
+
namespace facebook::react {
|
|
15
14
|
|
|
16
|
-
extern const char NativeScanComponentName[] = "NativeScan";
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
} // namespace facebook
|
|
16
|
+
|
|
17
|
+
} // namespace facebook::react
|
|
@@ -10,25 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
#pragma once
|
|
12
12
|
|
|
13
|
-
#include
|
|
14
|
-
#include
|
|
15
|
-
#include
|
|
13
|
+
#include "EventEmitters.h"
|
|
14
|
+
#include "Props.h"
|
|
15
|
+
#include "States.h"
|
|
16
16
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
17
|
#include <jsi/jsi.h>
|
|
18
18
|
|
|
19
|
-
namespace facebook {
|
|
20
|
-
namespace react {
|
|
19
|
+
namespace facebook::react {
|
|
21
20
|
|
|
22
|
-
JSI_EXPORT extern const char NativeScanComponentName[];
|
|
23
21
|
|
|
24
|
-
/*
|
|
25
|
-
* `ShadowNode` for <NativeScan> component.
|
|
26
|
-
*/
|
|
27
|
-
using NativeScanShadowNode = ConcreteViewShadowNode<
|
|
28
|
-
NativeScanComponentName,
|
|
29
|
-
NativeScanProps,
|
|
30
|
-
NativeScanEventEmitter,
|
|
31
|
-
NativeScanState>;
|
|
32
22
|
|
|
33
|
-
} // namespace react
|
|
34
|
-
} // namespace facebook
|
|
23
|
+
} // namespace facebook::react
|
|
@@ -7,12 +7,10 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @generated by codegen project: GenerateStateCpp.js
|
|
9
9
|
*/
|
|
10
|
-
#include
|
|
10
|
+
#include "States.h"
|
|
11
11
|
|
|
12
|
-
namespace facebook {
|
|
13
|
-
namespace react {
|
|
12
|
+
namespace facebook::react {
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
|
|
17
|
-
} // namespace react
|
|
18
|
-
} // namespace facebook
|
|
16
|
+
} // namespace facebook::react
|
|
@@ -10,27 +10,10 @@
|
|
|
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>
|
|
15
13
|
#endif
|
|
16
14
|
|
|
17
|
-
namespace facebook {
|
|
18
|
-
namespace react {
|
|
15
|
+
namespace facebook::react {
|
|
19
16
|
|
|
20
|
-
class NativeScanState {
|
|
21
|
-
public:
|
|
22
|
-
NativeScanState() = default;
|
|
23
17
|
|
|
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
|
-
};
|
|
34
18
|
|
|
35
|
-
} // namespace react
|
|
36
|
-
} // namespace facebook
|
|
19
|
+
} // namespace facebook::react
|
|
@@ -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 = RNC.NativeScan.NAME
|
|
23
|
+
public static readonly NAME:String = RNC.NativeScan.NAME
|
|
24
24
|
public ctx!: RNOHContext
|
|
25
25
|
public tag: number = 0
|
|
26
26
|
@State @Watch("changeProps") descriptor: NativeScanDescriptor = {} as NativeScanDescriptor //监听闪光灯
|
|
@@ -6,7 +6,6 @@
|
|
|
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'
|
|
10
9
|
import { TM } from './generated/ts'
|
|
11
10
|
import { RNQrDecodeImageCameraTurboModule } from './RNQrDecodeImageCameraTurboModule';
|
|
12
11
|
|
|
@@ -23,7 +22,7 @@ class RNQrDecodeImageCameraTurboModuleFactory extends TurboModulesFactory {
|
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
export class RNQrDecodeImageCameraPackage extends
|
|
25
|
+
export class RNQrDecodeImageCameraPackage extends RNPackage {
|
|
27
26
|
createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
|
|
28
27
|
return new RNQrDecodeImageCameraTurboModuleFactory(ctx);
|
|
29
28
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This code was generated by "react-native codegen-
|
|
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
|
|
3
8
|
*/
|
|
4
9
|
|
|
5
10
|
import {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This code was generated by "react-native codegen-
|
|
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.
|
|
3
6
|
*/
|
|
4
7
|
|
|
5
8
|
export * from "./NativeScan"
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-ohos/react-native-qr-decode-image-camera",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-rc.2",
|
|
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"
|
|
11
11
|
},
|
|
12
12
|
"harmony": {
|
|
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
|
-
}
|
|
13
|
+
"alias": "react-native-qr-decode-image-camera"
|
|
20
14
|
},
|
|
21
15
|
"keywords": [
|
|
22
16
|
"QRCode",
|
|
@@ -27,9 +21,11 @@
|
|
|
27
21
|
],
|
|
28
22
|
"dependencies": {
|
|
29
23
|
"prop-types": "^15.8.1",
|
|
30
|
-
"react-native-qr-decode-image-camera":"^1.1.3"
|
|
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"
|
|
31
27
|
},
|
|
32
|
-
"homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-qr-decode-image-camera",
|
|
28
|
+
"homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-qr-decode-image-camera#readme",
|
|
33
29
|
"repository": {
|
|
34
30
|
"type": "git",
|
|
35
31
|
"url": "https://gitcode.com/openharmony-sig/rntpc_react-native-qr-decode-image-camera.git"
|
|
@@ -39,10 +35,5 @@
|
|
|
39
35
|
"react-native": "^0.69.0",
|
|
40
36
|
"react-native-vision-camera":"^4.0.1",
|
|
41
37
|
"react-native-qr-decode-image-camera":"^1.1.3"
|
|
42
|
-
}
|
|
43
|
-
"publishConfig": {
|
|
44
|
-
"registry": "https://registry.npmjs.org/",
|
|
45
|
-
"access": "public"
|
|
46
|
-
},
|
|
47
|
-
"author": "deepanrajkumar"
|
|
38
|
+
}
|
|
48
39
|
}
|
package/src/Camera.tsx
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
import React, { useState, useEffect } from 'react';
|
|
8
8
|
import {
|
|
9
|
-
PixelRatio
|
|
9
|
+
PixelRatio,
|
|
10
|
+
StyleSheet
|
|
10
11
|
} from "react-native";
|
|
11
12
|
import { Camera, useCameraDevice, useCameraPermission } from 'react-native-vision-camera'
|
|
12
13
|
export const ComponentCamera = (props) => {
|
|
@@ -48,6 +49,7 @@ export const ComponentCamera = (props) => {
|
|
|
48
49
|
|
|
49
50
|
return (
|
|
50
51
|
<Camera
|
|
52
|
+
style={StyleSheet.absoluteFill}
|
|
51
53
|
isActive={props.isActive}
|
|
52
54
|
preview={true}
|
|
53
55
|
device={device}
|
|
@@ -137,7 +137,6 @@ 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 });
|
|
141
140
|
Vibration.vibrate();
|
|
142
141
|
this.props.onRead(e);
|
|
143
142
|
}
|
|
@@ -145,7 +144,6 @@ export default class QRScannerHarmony extends Component {
|
|
|
145
144
|
} else {
|
|
146
145
|
if (!this.isShowCode) {
|
|
147
146
|
this.isShowCode = true;
|
|
148
|
-
this.setState({ isActive: false });
|
|
149
147
|
Vibration.vibrate();
|
|
150
148
|
this.props.onRead(e);
|
|
151
149
|
}
|
package/src/QRScannerView.js
CHANGED
|
@@ -208,7 +208,8 @@ export default class QRScannerView extends Component {
|
|
|
208
208
|
style={[
|
|
209
209
|
this.getBorderSize(),
|
|
210
210
|
this.getBorderColor(),
|
|
211
|
-
this.getBorderWidth()
|
|
211
|
+
this.getBorderWidth(),
|
|
212
|
+
{ overflow: 'hidden' }
|
|
212
213
|
]}>
|
|
213
214
|
|
|
214
215
|
<Animated.View style={[animatedStyle]}>
|
|
@@ -321,7 +322,7 @@ export default class QRScannerView extends Component {
|
|
|
321
322
|
this.state.animatedValue.setValue(0); //重置Rotate动画值为0
|
|
322
323
|
Animated.timing(
|
|
323
324
|
this.state.animatedValue,
|
|
324
|
-
{toValue: this.props.rectHeight,
|
|
325
|
+
{toValue: this.props.rectHeight - this.props.scanBarHeight,
|
|
325
326
|
duration: this.props.scanBarAnimateTime,
|
|
326
327
|
easing: Easing.linear,
|
|
327
328
|
useNativeDriver: true
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
|
File without changes
|