@react-native-ohos/react-native-svg 15.12.1-rc.2 → 15.12.1-rc.5
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/harmony/svg/BuildProfile.ets +1 -1
- package/harmony/svg/oh-package.json5 +1 -1
- package/harmony/svg/src/main/cpp/SVGPackage.h +4 -0
- package/harmony/svg/src/main/cpp/SvgArkUINode.cpp +3 -0
- package/harmony/svg/src/main/cpp/SvgArkUINode.h +15 -9
- package/harmony/svg/src/main/cpp/SvgForeignObjectNode.cpp +86 -0
- package/harmony/svg/src/main/cpp/SvgForeignObjectNode.h +57 -0
- package/harmony/svg/src/main/cpp/SvgForeignObjectNodeDelegate.h +30 -0
- package/harmony/svg/src/main/cpp/SvgGroup.cpp +8 -1
- package/harmony/svg/src/main/cpp/SvgNode.cpp +65 -0
- package/harmony/svg/src/main/cpp/SvgNode.h +46 -12
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGForeignObjectComponentInstance.cpp +65 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGForeignObjectComponentInstance.h +50 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGGroupComponentInstance.h +8 -4
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGSvgViewComponentInstance.cpp +39 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGSvgViewComponentInstance.h +11 -2
- package/harmony/svg.har +0 -0
- package/lib/commonjs/css/index.js +54 -54
- package/lib/commonjs/css/index.js.map +1 -1
- package/lib/commonjs/index.js +25 -25
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/css/index.js +3 -3
- package/lib/module/css/index.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/babel.config.d.ts +8 -0
- package/lib/typescript/babel.config.d.ts.map +1 -0
- package/lib/typescript/example/babel.config.d.ts +3 -0
- package/lib/typescript/example/babel.config.d.ts.map +1 -0
- package/lib/typescript/example/contexts.d.ts +3 -0
- package/lib/typescript/example/contexts.d.ts.map +1 -0
- package/lib/typescript/example/harmony/entry/hvigorfile.d.ts +2 -0
- package/lib/typescript/example/harmony/entry/hvigorfile.d.ts.map +1 -0
- package/lib/typescript/example/harmony/hvigorfile.d.ts +2 -0
- package/lib/typescript/example/harmony/hvigorfile.d.ts.map +1 -0
- package/lib/typescript/example/index.d.ts +2 -0
- package/lib/typescript/example/index.d.ts.map +1 -0
- package/lib/typescript/example/jest.config.d.ts +3 -0
- package/lib/typescript/example/jest.config.d.ts.map +1 -0
- package/lib/typescript/example/metro.config.d.ts +3 -0
- package/lib/typescript/example/metro.config.d.ts.map +1 -0
- package/lib/typescript/example/react-native.config.d.ts +3 -0
- package/lib/typescript/example/react-native.config.d.ts.map +1 -0
- package/lib/typescript/example/scripts/create-build-profile.d.ts +2 -0
- package/lib/typescript/example/scripts/create-build-profile.d.ts.map +1 -0
- package/lib/typescript/example/src/index.d.ts +3 -0
- package/lib/typescript/example/src/index.d.ts.map +1 -0
- package/lib/typescript/src/css/index.d.ts +4 -0
- package/lib/typescript/src/css/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +6 -5
- package/tsconfig.json +1 -1
|
@@ -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 = '15.12.
|
|
4
|
+
export const HAR_VERSION = '15.12.1-rc.2';
|
|
5
5
|
export const BUILD_MODE_NAME = 'debug';
|
|
6
6
|
export const DEBUG = true;
|
|
7
7
|
export const TARGET_NAME = 'default';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
name: '@react-native-ohos/react-native-svg',
|
|
7
7
|
type: 'module',
|
|
8
8
|
main: 'index.ets',
|
|
9
|
-
version: '15.12.1-rc.
|
|
9
|
+
version: '15.12.1-rc.5',
|
|
10
10
|
dependencies: {
|
|
11
11
|
"@rnoh/react-native-openharmony": "file:../../node_modules/@react-native-oh/react-native-harmony/harmony/react_native_openharmony.har"
|
|
12
12
|
},
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
#include "RNOH/Package.h"
|
|
10
10
|
#include <glog/logging.h>
|
|
11
|
+
#include "componentInstances/RNSVGForeignObjectComponentInstance.h"
|
|
11
12
|
#include "componentInstances/RNSVGSvgViewComponentInstance.h"
|
|
12
13
|
#include "componentInstances/RNSVGCircleComponentInstance.h"
|
|
13
14
|
#include "componentInstances/RNSVGGroupComponentInstance.h"
|
|
@@ -51,6 +52,9 @@ public:
|
|
|
51
52
|
if (ctx.componentName == "RNSVGSvgView") {
|
|
52
53
|
return std::make_shared<RNSVGSvgViewComponentInstance>(std::move(ctx));
|
|
53
54
|
}
|
|
55
|
+
if (ctx.componentName == "RNSVGForeignObject") {
|
|
56
|
+
return std::make_shared<RNSVGForeignObjectComponentInstance>(std::move(ctx));
|
|
57
|
+
}
|
|
54
58
|
if (ctx.componentName == "RNSVGCircle") {
|
|
55
59
|
return std::make_shared<RNSVGCircleComponentInstance>(std::move(ctx));
|
|
56
60
|
}
|
|
@@ -55,6 +55,9 @@ SvgArkUINode::~SvgArkUINode() {
|
|
|
55
55
|
userCallback_ = nullptr;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
void SvgArkUINode::AddChild(ArkUINode &node) {
|
|
59
|
+
maybeThrow(NativeNodeApi::getInstance()->addChild(m_nodeHandle, node.getArkUINodeHandle()));
|
|
60
|
+
}
|
|
58
61
|
void SvgArkUINode::OnDraw(ArkUI_NodeCustomEvent *event) {
|
|
59
62
|
auto *drawContext = OH_ArkUI_NodeCustomEvent_GetDrawContextInDraw(event);
|
|
60
63
|
auto *drawingHandle = reinterpret_cast<OH_Drawing_Canvas *>(OH_ArkUI_DrawContext_GetCanvas(drawContext));
|
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
#pragma once
|
|
8
8
|
|
|
9
|
-
#include "SvgNode.h"
|
|
10
|
-
#include "SvgHost.h"
|
|
11
9
|
#include "RNOH/arkui/ArkUINode.h"
|
|
10
|
+
#include "SvgForeignObjectNodeDelegate.h"
|
|
11
|
+
#include "SvgHost.h"
|
|
12
|
+
#include "SvgNode.h"
|
|
12
13
|
#include "arkui/native_node.h"
|
|
13
14
|
|
|
14
15
|
namespace rnoh {
|
|
@@ -26,18 +27,23 @@ private:
|
|
|
26
27
|
std::weak_ptr<SvgNode> root_;
|
|
27
28
|
ArkUI_NativeNodeAPI_1 *nativeModule_ = nullptr;
|
|
28
29
|
UserCallback *userCallback_ = nullptr;
|
|
30
|
+
std::weak_ptr<SvgNode> _groupNode;
|
|
31
|
+
std::vector<ForeignProps> foreignPropsArray;
|
|
29
32
|
void (*eventReceiver)(ArkUI_NodeCustomEvent *event);
|
|
30
|
-
|
|
33
|
+
|
|
31
34
|
public:
|
|
32
35
|
SvgArkUINode();
|
|
33
36
|
~SvgArkUINode() override;
|
|
34
37
|
|
|
35
|
-
void SetSvgNode(const std::weak_ptr<SvgNode
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
void
|
|
40
|
-
|
|
38
|
+
void SetSvgNode(const std::weak_ptr<SvgNode> &node) { root_ = node; }
|
|
39
|
+
void SetGroupNode(const std::weak_ptr<SvgNode> &node) { _groupNode = node; }
|
|
40
|
+
void ResetNodeHandle() {}
|
|
41
|
+
void AddChild(ArkUINode &node);
|
|
42
|
+
void SetForeignObject(OH_PixelmapNative *pixelMap, float w, float h, float x, float y) {
|
|
43
|
+
ForeignProps foreignProps = {std::move(pixelMap), w, h, x, y};
|
|
44
|
+
if (auto groupNode = _groupNode.lock()) {
|
|
45
|
+
groupNode->SetForeignObject(std::move(foreignProps));
|
|
46
|
+
}
|
|
41
47
|
}
|
|
42
48
|
};
|
|
43
49
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*
|
|
6
|
+
* This file incorporates from the OpenHarmony project, licensed under
|
|
7
|
+
* the Apache License, Version 2.0. Specifically:
|
|
8
|
+
* - [OpenHarmony/arkui_ace_engine] (https://gitee.com/openharmony/arkui_ace_engine)
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
11
|
+
* use this file except in compliance with the License. You may obtain a copy
|
|
12
|
+
* of the License at:
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
17
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
18
|
+
* License for the specific language governing permissions and limitations
|
|
19
|
+
* under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#include "SvgForeignObjectNode.h"
|
|
23
|
+
#include "RNOH/arkui/NativeNodeApi.h"
|
|
24
|
+
#include <deviceinfo.h>
|
|
25
|
+
#include <info/application_target_sdk_version.h>
|
|
26
|
+
namespace rnoh {
|
|
27
|
+
namespace svg {
|
|
28
|
+
SvgForeignObjectNode::SvgForeignObjectNode()
|
|
29
|
+
: ArkUINode(NativeNodeApi::getInstance()->createNode(ArkUI_NodeType::ARKUI_NODE_STACK)) {
|
|
30
|
+
mStackNode.setVisibility(ArkUI_Visibility::ARKUI_VISIBILITY_HIDDEN);
|
|
31
|
+
mStackNode.setClip(true);
|
|
32
|
+
maybeThrow(NativeNodeApi::getInstance()->addChild(m_nodeHandle, mStackNode.getArkUINodeHandle()));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
SvgForeignObjectNode::~SvgForeignObjectNode() {
|
|
36
|
+
if (m_NodeDelegate) {
|
|
37
|
+
m_NodeDelegate = nullptr;
|
|
38
|
+
}
|
|
39
|
+
_isGeneratedPixelMap = false;
|
|
40
|
+
}
|
|
41
|
+
void SvgForeignObjectNode::insertChild(ArkUINode &child, std::size_t index) { mStackNode.insertChild(child, index); }
|
|
42
|
+
|
|
43
|
+
void SvgForeignObjectNode::SetSnapHeight(float height) { _height = height; }
|
|
44
|
+
|
|
45
|
+
void SvgForeignObjectNode::SetSnapWidth(float width) { _width = width; }
|
|
46
|
+
|
|
47
|
+
void SvgForeignObjectNode::SetSnapPosition(float x, float y) {
|
|
48
|
+
_positionX = x;
|
|
49
|
+
_positionY = y;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
void SvgForeignObjectNode::onNodeEvent(ArkUI_NodeEventType eventType, EventArgs &eventArgs) {
|
|
53
|
+
if (eventType == ArkUI_NodeEventType::NODE_EVENT_ON_AREA_CHANGE) {
|
|
54
|
+
if (m_NodeDelegate && _isGeneratedPixelMap) {
|
|
55
|
+
OH_PixelmapNative *pixelMap = GetNodePixelMap();
|
|
56
|
+
if (!pixelMap) {
|
|
57
|
+
LOG(ERROR) << "[svgForeignNode] get node snapshot pixelMap is null";
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
_isGeneratedPixelMap = false;
|
|
61
|
+
m_NodeDelegate->onDrawForeignImage(pixelMap, _width, _height, _positionX, _positionY);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
OH_PixelmapNative *SvgForeignObjectNode::GetNodePixelMap() {
|
|
67
|
+
DLOG(INFO) << "[svgForeignNode] OH_CURRENT_API_VERSION:" << OH_CURRENT_API_VERSION
|
|
68
|
+
<< ";ROM SDK:" << OH_GetSdkApiVersion();
|
|
69
|
+
|
|
70
|
+
#if OH_CURRENT_API_VERSION >= 15
|
|
71
|
+
if (OH_GetSdkApiVersion() < 15) {
|
|
72
|
+
return nullptr;
|
|
73
|
+
}
|
|
74
|
+
OH_PixelmapNative *pixelMap;
|
|
75
|
+
ArkUI_SnapshotOptions *options = OH_ArkUI_CreateSnapshotOptions();
|
|
76
|
+
OH_ArkUI_SnapshotOptions_SetScale(options, 1);
|
|
77
|
+
int32_t code = OH_ArkUI_GetNodeSnapshot(mStackNode.getArkUINodeHandle(), options, &pixelMap);
|
|
78
|
+
if (code == ARKUI_ERROR_CODE_NO_ERROR) {
|
|
79
|
+
return pixelMap;
|
|
80
|
+
}
|
|
81
|
+
#endif
|
|
82
|
+
return nullptr;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
} // namespace svg
|
|
86
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*
|
|
6
|
+
* This file incorporates from the OpenHarmony project, licensed under
|
|
7
|
+
* the Apache License, Version 2.0. Specifically:
|
|
8
|
+
* - [OpenHarmony/arkui_ace_engine] (https://gitee.com/openharmony/arkui_ace_engine)
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
11
|
+
* use this file except in compliance with the License. You may obtain a copy
|
|
12
|
+
* of the License at:
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
17
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
18
|
+
* License for the specific language governing permissions and limitations
|
|
19
|
+
* under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#ifndef HARMONY_SVGFOREIGNOBJECTNODE_H
|
|
23
|
+
#define HARMONY_SVGFOREIGNOBJECTNODE_H
|
|
24
|
+
#include "RNOH/arkui/ArkUINode.h"
|
|
25
|
+
#include "RNOH/arkui/StackNode.h"
|
|
26
|
+
#include "SvgForeignObjectNodeDelegate.h"
|
|
27
|
+
|
|
28
|
+
namespace rnoh {
|
|
29
|
+
namespace svg {
|
|
30
|
+
class SvgForeignObjectNode : public ArkUINode {
|
|
31
|
+
public:
|
|
32
|
+
SvgForeignObjectNode();
|
|
33
|
+
~SvgForeignObjectNode() override;
|
|
34
|
+
void onNodeEvent(ArkUI_NodeEventType eventType, EventArgs &eventArgs) override;
|
|
35
|
+
StackNode &getSnapNode() { return mStackNode; }
|
|
36
|
+
void insertChild(ArkUINode &child, std::size_t index);
|
|
37
|
+
void SetSnapPosition(float x, float y);
|
|
38
|
+
void SetSnapWidth(float width);
|
|
39
|
+
void SetSnapHeight(float height);
|
|
40
|
+
OH_PixelmapNative *GetNodePixelMap();
|
|
41
|
+
void SetForeignNodeDelegate(SvgForeignObjectNodeDelegate *delegate) { m_NodeDelegate = delegate; };
|
|
42
|
+
void SetGeneratedPixelMap(bool isNeed) {
|
|
43
|
+
_isGeneratedPixelMap = isNeed;
|
|
44
|
+
}
|
|
45
|
+
private:
|
|
46
|
+
StackNode mStackNode;
|
|
47
|
+
SvgForeignObjectNodeDelegate *m_NodeDelegate;
|
|
48
|
+
float _width{0};
|
|
49
|
+
float _height{0};
|
|
50
|
+
float _positionX{0};
|
|
51
|
+
float _positionY{0};
|
|
52
|
+
bool _isGeneratedPixelMap{false}; //防止快照生成多次,导致性能影响
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
} // namespace svg
|
|
56
|
+
} // namespace rnoh
|
|
57
|
+
#endif // HARMONY_SVGFOREIGNOBJECTNODE_H
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*
|
|
6
|
+
* This file incorporates from the OpenHarmony project, licensed under
|
|
7
|
+
* the Apache License, Version 2.0. Specifically:
|
|
8
|
+
* - [OpenHarmony/arkui_ace_engine] (https://gitee.com/openharmony/arkui_ace_engine)
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
11
|
+
* use this file except in compliance with the License. You may obtain a copy
|
|
12
|
+
* of the License at:
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
17
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
18
|
+
* License for the specific language governing permissions and limitations
|
|
19
|
+
* under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#ifndef HARMONY_SVGFOREIGNOBJECTNODEDELEGATE_H
|
|
23
|
+
#define HARMONY_SVGFOREIGNOBJECTNODEDELEGATE_H
|
|
24
|
+
#include <multimedia/image_framework/image/pixelmap_native.h>
|
|
25
|
+
class SvgForeignObjectNodeDelegate {
|
|
26
|
+
public:
|
|
27
|
+
virtual ~SvgForeignObjectNodeDelegate() = default;
|
|
28
|
+
virtual void onDrawForeignImage(OH_PixelmapNative *foreignPixelMap,float width,float height,float x,float y){};
|
|
29
|
+
};
|
|
30
|
+
#endif //HARMONY_SVGFOREIGNOBJECTNODEDELEGATE_H
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
#include "SvgGroup.h"
|
|
8
8
|
#include "SvgFilter.h"
|
|
9
|
+
#include "drawing/Brush.h"
|
|
9
10
|
|
|
10
11
|
namespace rnoh {
|
|
11
12
|
namespace svg {
|
|
@@ -30,7 +31,13 @@ void SvgGroup::OnInitStyle() {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
void SvgGroup::OnDraw(OH_Drawing_Canvas *canvas) {
|
|
33
|
-
|
|
34
|
+
if (attributes_.selfOpacity < 1.0) {
|
|
35
|
+
drawing::Brush layerBrush;
|
|
36
|
+
uint8_t alpha= static_cast<uint8_t>(attributes_.selfOpacity* 255);
|
|
37
|
+
layerBrush.SetAlpha(alpha);
|
|
38
|
+
OH_Drawing_CanvasSaveLayer(canvas, nullptr, layerBrush.get());
|
|
39
|
+
}
|
|
40
|
+
SvgNode::OnDraw(canvas);
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
void SvgGroup::ApplyFilterToChildren(std::shared_ptr<SvgFilter> filter) {
|
|
@@ -23,11 +23,13 @@
|
|
|
23
23
|
#include "utils/SvgUtils.h"
|
|
24
24
|
#include "SvgGradient.h"
|
|
25
25
|
#include "SvgPattern.h"
|
|
26
|
+
#include "properties/ViewBox.h"
|
|
26
27
|
#include "SvgFilter.h"
|
|
27
28
|
#include <native_drawing/drawing_matrix.h>
|
|
28
29
|
#include <native_drawing/drawing_path.h>
|
|
29
30
|
#include <regex>
|
|
30
31
|
#include <string>
|
|
32
|
+
#include <native_drawing/drawing_pixel_map.h>
|
|
31
33
|
|
|
32
34
|
namespace rnoh {
|
|
33
35
|
namespace svg {
|
|
@@ -75,6 +77,7 @@ void SvgNode::InitStyle(const SvgBaseAttribute &attr) {
|
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
}
|
|
80
|
+
OnInitStyle();
|
|
78
81
|
if (passStyle_) {
|
|
79
82
|
for (auto &node : children_) {
|
|
80
83
|
if (node) {
|
|
@@ -204,6 +207,13 @@ void SvgNode::Draw(OH_Drawing_Canvas *canvas) {
|
|
|
204
207
|
// on marker
|
|
205
208
|
|
|
206
209
|
OnDrawTraversed(canvas);
|
|
210
|
+
|
|
211
|
+
if (_foreignPropsArray.size() > 0) {
|
|
212
|
+
for (ForeignProps _foreignProps : _foreignPropsArray) {
|
|
213
|
+
DrawForeignPixelMap(canvas, _foreignProps);
|
|
214
|
+
}
|
|
215
|
+
_foreignPropsArray.clear();
|
|
216
|
+
}
|
|
207
217
|
OH_Drawing_CanvasRestoreToCount(canvas, count);
|
|
208
218
|
}
|
|
209
219
|
|
|
@@ -285,5 +295,60 @@ double SvgNode::getCanvasDiagonal() {
|
|
|
285
295
|
canvasDiagonal_ = sqrt(powX + powY) * M_SQRT1_2l;
|
|
286
296
|
return canvasDiagonal_;
|
|
287
297
|
}
|
|
298
|
+
|
|
299
|
+
void SvgNode::DrawForeignPixelMap(OH_Drawing_Canvas *canvas, ForeignProps _foreignProps) {
|
|
300
|
+
if (!_foreignProps.foreignPixelMap) {
|
|
301
|
+
DLOG(INFO) << "[svgForeignNode] foreignPixelMap is null";
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
DLOG(INFO) << "[svgForeignNode] DrawForeignPixelMap start , width:" << _foreignProps.width;
|
|
305
|
+
OH_Pixelmap_ImageInfo *imageInfo;
|
|
306
|
+
OH_PixelmapImageInfo_Create(&imageInfo);
|
|
307
|
+
|
|
308
|
+
OH_PixelmapNative_GetImageInfo(_foreignProps.foreignPixelMap, imageInfo);
|
|
309
|
+
uint32_t originalWidth = 0, originalHeight = 0;
|
|
310
|
+
OH_PixelmapImageInfo_GetWidth(imageInfo, &originalWidth);
|
|
311
|
+
OH_PixelmapImageInfo_GetHeight(imageInfo, &originalHeight);
|
|
312
|
+
OH_PixelmapImageInfo_Release(imageInfo);
|
|
313
|
+
|
|
314
|
+
if (originalWidth == 0 || originalHeight == 0) {
|
|
315
|
+
DLOG(WARNING) << "[svgForeignNode] Invalid pixelmap size";
|
|
316
|
+
OH_PixelmapNative_Release(_foreignProps.foreignPixelMap);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
OH_Drawing_PixelMap *ohPixelMap = OH_Drawing_PixelMapGetFromOhPixelMapNative(_foreignProps.foreignPixelMap);
|
|
321
|
+
if (!ohPixelMap) {
|
|
322
|
+
DLOG(WARNING) << "[svgForeignNode] Failed to get OH_Drawing_PixelMap";
|
|
323
|
+
OH_PixelmapNative_Release(_foreignProps.foreignPixelMap);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
OH_Drawing_CanvasSave(canvas);
|
|
328
|
+
|
|
329
|
+
OH_Drawing_CanvasTranslate(canvas, _foreignProps.x, _foreignProps.y);
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
float scaleX = static_cast<float>(_foreignProps.width) / originalWidth;
|
|
333
|
+
float scaleY = static_cast<float>(_foreignProps.height) / originalHeight;
|
|
334
|
+
OH_Drawing_CanvasScale(canvas, 1, 1);
|
|
335
|
+
|
|
336
|
+
OH_Drawing_Rect *srcRect = OH_Drawing_RectCreate(0, 0, originalWidth, originalHeight);
|
|
337
|
+
OH_Drawing_Rect *dstRect = OH_Drawing_RectCreate(0, 0, originalWidth, originalHeight);
|
|
338
|
+
OH_Drawing_SamplingOptions *sampling = OH_Drawing_SamplingOptionsCreate(FILTER_MODE_LINEAR, MIPMAP_MODE_LINEAR);
|
|
339
|
+
OH_Drawing_CanvasDrawPixelMapRect(canvas, ohPixelMap, srcRect, dstRect, sampling);
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
OH_Drawing_CanvasRestore(canvas);
|
|
343
|
+
OH_Drawing_PixelMapDissolve(ohPixelMap);
|
|
344
|
+
OH_PixelmapNative_Release(_foreignProps.foreignPixelMap);
|
|
345
|
+
OH_Drawing_RectDestroy(srcRect);
|
|
346
|
+
OH_Drawing_RectDestroy(dstRect);
|
|
347
|
+
OH_Drawing_SamplingOptionsDestroy(sampling);
|
|
348
|
+
|
|
349
|
+
_foreignProps.foreignPixelMap = nullptr;
|
|
350
|
+
DLOG(INFO) << "[svgForeignNode] DrawForeignPixelMap end";
|
|
351
|
+
}
|
|
352
|
+
|
|
288
353
|
} // namespace svg
|
|
289
354
|
} // namespace rnoh
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
#include "utils/StringUtils.h"
|
|
37
37
|
#include "utils/SvgAttributesParser.h"
|
|
38
38
|
#include <glog/logging.h>
|
|
39
|
+
#include <multimedia/image_framework/image/pixelmap_native.h>
|
|
39
40
|
#include <native_drawing/drawing_canvas.h>
|
|
40
41
|
#include <native_drawing/drawing_rect.h>
|
|
41
42
|
#include "utils/DynamicUtils.h"
|
|
@@ -43,6 +44,15 @@
|
|
|
43
44
|
namespace rnoh {
|
|
44
45
|
namespace svg {
|
|
45
46
|
|
|
47
|
+
struct ForeignProps {
|
|
48
|
+
OH_PixelmapNative *foreignPixelMap{nullptr};
|
|
49
|
+
float width;
|
|
50
|
+
float height;
|
|
51
|
+
float x;
|
|
52
|
+
float y;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
|
|
46
56
|
constexpr int INHERIT_TYPE = 2;
|
|
47
57
|
|
|
48
58
|
class SvgNode : public std::enable_shared_from_this<SvgNode> {
|
|
@@ -174,18 +184,32 @@ public:
|
|
|
174
184
|
|
|
175
185
|
// Handle stroke properties - support both generic and text-specific structures
|
|
176
186
|
if constexpr (requires { props->stroke; }) {
|
|
177
|
-
if (!props->stroke.isNull() && props->stroke.count("type") > 0
|
|
187
|
+
if (!props->stroke.isNull() && props->stroke.count("type") > 0) {
|
|
178
188
|
int strokeType = props->stroke["type"].asInt();
|
|
179
189
|
if (strokeType == INHERIT_TYPE) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
uint32_t colorValue = static_cast<uint32_t>(props->stroke["payload"].asInt());
|
|
185
|
-
if (facebook::react::isColorMeaningful(facebook::react::SharedColor(colorValue))) {
|
|
186
|
-
attributes_.strokeState.SetColor(Color(colorValue), set.count("stroke"));
|
|
190
|
+
if (props->stroke.count("payload") > 0) {
|
|
191
|
+
Color color = Color(static_cast<uint32_t>(props->stroke["payload"].asInt()));
|
|
192
|
+
color.SetUseCurrentColor(true);
|
|
193
|
+
attributes_.strokeState.SetColor(color, true);
|
|
187
194
|
} else {
|
|
188
|
-
|
|
195
|
+
if (props->color) {
|
|
196
|
+
Color color = Color(*props->color);
|
|
197
|
+
color.SetUseCurrentColor(true);
|
|
198
|
+
attributes_.strokeState.SetColor(color, true);
|
|
199
|
+
} else {
|
|
200
|
+
Color color = Color::TRANSPARENT;
|
|
201
|
+
color.SetUseCurrentColor(true);
|
|
202
|
+
attributes_.strokeState.SetColor(color, true);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
} else {
|
|
206
|
+
if (props->stroke.count("payload") > 0) {
|
|
207
|
+
uint32_t colorValue = static_cast<uint32_t>(props->stroke["payload"].asInt());
|
|
208
|
+
if (facebook::react::isColorMeaningful(facebook::react::SharedColor(colorValue))) {
|
|
209
|
+
attributes_.strokeState.SetColor(Color(colorValue), set.count("stroke"));
|
|
210
|
+
} else {
|
|
211
|
+
attributes_.strokeState.SetColor(Color::TRANSPARENT, set.count("stroke"));
|
|
212
|
+
}
|
|
189
213
|
}
|
|
190
214
|
}
|
|
191
215
|
} else if (!props->stroke.isNull() && props->stroke.count("payload") > 0) {
|
|
@@ -256,10 +280,14 @@ public:
|
|
|
256
280
|
attributes_.Inherit(parent);
|
|
257
281
|
// svg color -> current color
|
|
258
282
|
if (attributes_.strokeState.GetColor().IsUseCurrentColor()) {
|
|
259
|
-
|
|
283
|
+
if(context_) {
|
|
284
|
+
attributes_.strokeState.SetColor(context_->GetSvgColor(), true);
|
|
285
|
+
}
|
|
260
286
|
}
|
|
261
287
|
if (attributes_.fillState.GetColor().IsUseCurrentColor()) {
|
|
262
|
-
|
|
288
|
+
if(context_) {
|
|
289
|
+
attributes_.fillState.SetColor(context_->GetSvgColor(), true);
|
|
290
|
+
}
|
|
263
291
|
}
|
|
264
292
|
}
|
|
265
293
|
|
|
@@ -275,6 +303,10 @@ public:
|
|
|
275
303
|
double getCanvasHeight();
|
|
276
304
|
double getCanvasDiagonal();
|
|
277
305
|
|
|
306
|
+
void SetForeignObject(ForeignProps foreignProps) {
|
|
307
|
+
_foreignPropsArray.emplace_back(foreignProps);
|
|
308
|
+
}
|
|
309
|
+
|
|
278
310
|
protected:
|
|
279
311
|
// override as need by derived class
|
|
280
312
|
// called by function AppendChild
|
|
@@ -296,7 +328,7 @@ protected:
|
|
|
296
328
|
std::optional<Gradient> GetGradient(const std::string &href);
|
|
297
329
|
|
|
298
330
|
std::shared_ptr<PatternAttr> GetPatternAttr(const std::string &href);
|
|
299
|
-
|
|
331
|
+
void DrawForeignPixelMap(OH_Drawing_Canvas *canvas,ForeignProps _foreignProps);
|
|
300
332
|
void InitNoneFlag() {
|
|
301
333
|
hrefFill_ = false;
|
|
302
334
|
hrefRender_ = false;
|
|
@@ -341,6 +373,8 @@ protected:
|
|
|
341
373
|
Provide enough digits for the 128-bit IEEE quad (36 significant digits).
|
|
342
374
|
*/
|
|
343
375
|
const double M_SQRT1_2l = 0.707106781186547524400844362104849039;
|
|
376
|
+
|
|
377
|
+
std::vector<ForeignProps> _foreignPropsArray;
|
|
344
378
|
};
|
|
345
379
|
|
|
346
380
|
} // namespace svg
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*
|
|
6
|
+
* This file incorporates from the OpenHarmony project, licensed under
|
|
7
|
+
* the Apache License, Version 2.0. Specifically:
|
|
8
|
+
* - [OpenHarmony/arkui_ace_engine] (https://gitee.com/openharmony/arkui_ace_engine)
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
11
|
+
* use this file except in compliance with the License. You may obtain a copy
|
|
12
|
+
* of the License at:
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
17
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
18
|
+
* License for the specific language governing permissions and limitations
|
|
19
|
+
* under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#include "RNSVGForeignObjectComponentInstance.h"
|
|
23
|
+
namespace rnoh {
|
|
24
|
+
namespace svg {
|
|
25
|
+
|
|
26
|
+
RNSVGForeignObjectComponentInstance::RNSVGForeignObjectComponentInstance(Context context)
|
|
27
|
+
: CppComponentInstance(std::move(context)) {
|
|
28
|
+
DLOG(INFO) << "RNSVGForeignObjectComponentInstance";
|
|
29
|
+
NativeNodeApi::getInstance()->registerNodeEvent(mForeignStackNode.getArkUINodeHandle(), NODE_EVENT_ON_AREA_CHANGE,
|
|
30
|
+
NODE_EVENT_ON_AREA_CHANGE, this);
|
|
31
|
+
mForeignStackNode.insertChild(node, 0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
RNSVGForeignObjectComponentInstance::~RNSVGForeignObjectComponentInstance() {
|
|
36
|
+
NativeNodeApi::getInstance()->unregisterNodeEvent(mForeignStackNode.getArkUINodeHandle(), NODE_EVENT_ON_AREA_CHANGE);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
void RNSVGForeignObjectComponentInstance::onFinalizeUpdates() {
|
|
40
|
+
ComponentInstance::onFinalizeUpdates();
|
|
41
|
+
if (m_props) {
|
|
42
|
+
float pointScaleFactor = getLayoutMetrics().pointScaleFactor;
|
|
43
|
+
mForeignStackNode.SetSnapPosition(pointScaleFactor * std::stof(DynamicUtils::DynamicToString(m_props->x)),
|
|
44
|
+
pointScaleFactor * std::stof(DynamicUtils::DynamicToString(m_props->y)));
|
|
45
|
+
mForeignStackNode.SetSnapWidth(pointScaleFactor * std::stof(DynamicUtils::DynamicToString(m_props->width)));
|
|
46
|
+
mForeignStackNode.SetSnapHeight(pointScaleFactor * std::stof(DynamicUtils::DynamicToString(m_props->height)));
|
|
47
|
+
mForeignStackNode.SetGeneratedPixelMap(true);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
void RNSVGForeignObjectComponentInstance::onChildInserted(ComponentInstance::Shared const &childComponentInstance,
|
|
52
|
+
std::size_t index) {
|
|
53
|
+
CppComponentInstance::onChildInserted(childComponentInstance, index);
|
|
54
|
+
node.insertChild(childComponentInstance->getLocalRootArkUINode(), index);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
void RNSVGForeignObjectComponentInstance::onChildRemoved(ComponentInstance::Shared const &childComponentInstance) {
|
|
58
|
+
CppComponentInstance::onChildRemoved(childComponentInstance);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
SvgForeignObjectNode &RNSVGForeignObjectComponentInstance::getLocalRootArkUINode() { return mForeignStackNode; }
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
} // namespace svg
|
|
65
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*
|
|
6
|
+
* This file incorporates from the OpenHarmony project, licensed under
|
|
7
|
+
* the Apache License, Version 2.0. Specifically:
|
|
8
|
+
* - [OpenHarmony/arkui_ace_engine] (https://gitee.com/openharmony/arkui_ace_engine)
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
11
|
+
* use this file except in compliance with the License. You may obtain a copy
|
|
12
|
+
* of the License at:
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
17
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
18
|
+
* License for the specific language governing permissions and limitations
|
|
19
|
+
* under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#ifndef RNSVG_FOREIGN_OBJECT_COMPONENT_INSTANCE_H
|
|
23
|
+
#define RNSVG_FOREIGN_OBJECT_COMPONENT_INSTANCE_H
|
|
24
|
+
#include "RNOH/CppComponentInstance.h"
|
|
25
|
+
#include "SvgForeignObjectNode.h"
|
|
26
|
+
#include <react/renderer/components/react_native_svg/ShadowNodes.h>
|
|
27
|
+
#include "RNOH/arkui/ColumnNode.h"
|
|
28
|
+
#include "RNOH/arkui/NativeNodeApi.h"
|
|
29
|
+
#include "utils/DynamicUtils.h"
|
|
30
|
+
namespace rnoh {
|
|
31
|
+
namespace svg {
|
|
32
|
+
class RNSVGForeignObjectComponentInstance : public CppComponentInstance<facebook::react::RNSVGForeignObjectShadowNode> {
|
|
33
|
+
public:
|
|
34
|
+
RNSVGForeignObjectComponentInstance(Context context);
|
|
35
|
+
~RNSVGForeignObjectComponentInstance();
|
|
36
|
+
|
|
37
|
+
void onFinalizeUpdates() override;
|
|
38
|
+
void onChildInserted(ComponentInstance::Shared const &childComponentInstance, std::size_t index) override;
|
|
39
|
+
|
|
40
|
+
void onChildRemoved(ComponentInstance::Shared const &childComponentInstance) override;
|
|
41
|
+
|
|
42
|
+
SvgForeignObjectNode &getLocalRootArkUINode() override;
|
|
43
|
+
|
|
44
|
+
private:
|
|
45
|
+
SvgForeignObjectNode mForeignStackNode;
|
|
46
|
+
ColumnNode node;
|
|
47
|
+
};
|
|
48
|
+
} // namespace svg
|
|
49
|
+
} // namespace rnoh
|
|
50
|
+
#endif // RNSVG_FOREIGN_OBJECT_COMPONENT_INSTANCE_H
|
|
@@ -3,7 +3,8 @@
|
|
|
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
|
+
#ifndef RNSVG_GROUP_COMPONENT_INSTANCE_H
|
|
7
|
+
#define RNSVG_GROUP_COMPONENT_INSTANCE_H
|
|
7
8
|
#pragma once
|
|
8
9
|
|
|
9
10
|
#include "RNSVGBaseComponentInstance.h"
|
|
@@ -15,13 +16,16 @@ namespace svg {
|
|
|
15
16
|
class RNSVGGroupComponentInstance : public RNSVGBaseComponentInstance<facebook::react::RNSVGGroupShadowNode> {
|
|
16
17
|
public:
|
|
17
18
|
explicit RNSVGGroupComponentInstance(Context context);
|
|
18
|
-
|
|
19
|
+
std::shared_ptr<SvgGroup> getNode(){
|
|
20
|
+
return m_svgGroup;
|
|
21
|
+
}
|
|
19
22
|
protected:
|
|
20
23
|
void UpdateElementProps() override;
|
|
21
|
-
|
|
24
|
+
|
|
22
25
|
private:
|
|
23
26
|
std::shared_ptr<SvgGroup> m_svgGroup = std::make_shared<SvgGroup>();
|
|
24
27
|
};
|
|
25
28
|
|
|
26
29
|
} // namespace svg
|
|
27
|
-
} // namespace rnoh
|
|
30
|
+
} // namespace rnoh
|
|
31
|
+
#endif // RNSVG_GROUP_COMPONENT_INSTANCE_H
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
#include "RNSVGSvgViewComponentInstance.h"
|
|
8
8
|
#include "utils/DynamicUtils.h"
|
|
9
9
|
#include <glog/logging.h>
|
|
10
|
+
#include "RNSVGGroupComponentInstance.h"
|
|
10
11
|
|
|
11
12
|
namespace rnoh {
|
|
12
13
|
namespace svg {
|
|
@@ -21,6 +22,7 @@ RNSVGSvgViewComponentInstance::RNSVGSvgViewComponentInstance(Context context)
|
|
|
21
22
|
|
|
22
23
|
RNSVGSvgViewComponentInstance::~RNSVGSvgViewComponentInstance() {
|
|
23
24
|
SvgViewManager::getInstance().onDropView(CppComponentInstance::getTag());
|
|
25
|
+
noSvgComponentIndex = 0;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
void RNSVGSvgViewComponentInstance::onFinalizeUpdates() {
|
|
@@ -45,9 +47,46 @@ void RNSVGSvgViewComponentInstance::onFinalizeUpdates() {
|
|
|
45
47
|
getLocalRootArkUINode().markDirty();
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
void RNSVGSvgViewComponentInstance::onDrawForeignImage(OH_PixelmapNative *foreignPixelMap, float width, float height,
|
|
51
|
+
float x, float y) {
|
|
52
|
+
if (foreignPixelMap) {
|
|
53
|
+
DLOG(INFO) << "[svgForeignNode] RNSVGSvgViewComponentInstance OH_PixelmapNative is not null, position:{ x:" << x
|
|
54
|
+
<< ",y:" << y << "},width:" << width << ";height:" << height;
|
|
55
|
+
m_svgArkUINode.SetForeignObject(foreignPixelMap, width, height, x, y);
|
|
56
|
+
m_svgArkUINode.markDirty();
|
|
57
|
+
} else {
|
|
58
|
+
DLOG(INFO) << "RNSVGSvgViewComponentInstance OH_PixelmapNative is null";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
48
61
|
void RNSVGSvgViewComponentInstance::onChildInserted(ComponentInstance::Shared const &childComponentInstance,
|
|
49
62
|
std::size_t index) {
|
|
50
63
|
CppComponentInstance::onChildInserted(childComponentInstance, index);
|
|
64
|
+
if (childComponentInstance->getComponentName() == "RNSVGGroup") {
|
|
65
|
+
auto childInstance = childComponentInstance->getChildren();
|
|
66
|
+
for (ComponentInstance::Shared c : childInstance) {
|
|
67
|
+
if (c->getComponentName().find("SVG") == std::string::npos) {
|
|
68
|
+
NativeNodeApi::getInstance()->insertChildAt(m_svgArkUINode.getArkUINodeHandle(),
|
|
69
|
+
c->getLocalRootArkUINode().getArkUINodeHandle(), noSvgComponentIndex);
|
|
70
|
+
noSvgComponentIndex++;
|
|
71
|
+
}
|
|
72
|
+
auto groupChildInstance = c->getChildren();
|
|
73
|
+
for (ComponentInstance::Shared c1 : groupChildInstance) {
|
|
74
|
+
if (c1->getComponentName() == "RNSVGForeignObject") {
|
|
75
|
+
auto m_foreignComponentInstance =
|
|
76
|
+
std::dynamic_pointer_cast<RNSVGForeignObjectComponentInstance>(c1);
|
|
77
|
+
if (m_foreignComponentInstance) {
|
|
78
|
+
auto groupInstance =
|
|
79
|
+
std::dynamic_pointer_cast<RNSVGGroupComponentInstance>(c1->getParent().lock());
|
|
80
|
+
m_svgArkUINode.SetGroupNode(groupInstance->getNode());
|
|
81
|
+
m_svgArkUINode.AddChild(m_foreignComponentInstance->getLocalRootArkUINode());
|
|
82
|
+
m_foreignComponentInstance->getLocalRootArkUINode().SetForeignNodeDelegate(this);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
51
90
|
OnChildInsertCommon(std::dynamic_pointer_cast<SvgHost>(childComponentInstance));
|
|
52
91
|
}
|
|
53
92
|
|
|
@@ -12,18 +12,26 @@
|
|
|
12
12
|
#include <react/renderer/components/react_native_svg/ShadowNodes.h>
|
|
13
13
|
#include "SvgViewManager.h"
|
|
14
14
|
#include "SvgSvg.h"
|
|
15
|
+
#include "RNSVGForeignObjectComponentInstance.h"
|
|
16
|
+
|
|
17
|
+
namespace rnoh {
|
|
18
|
+
namespace svg {
|
|
19
|
+
class RNSVGGroupComponentInstance;
|
|
20
|
+
} // namespace svg
|
|
21
|
+
} // namespace rnoh
|
|
22
|
+
|
|
15
23
|
|
|
16
24
|
namespace rnoh {
|
|
17
25
|
namespace svg {
|
|
18
26
|
|
|
19
27
|
class RNSVGSvgViewComponentInstance : public CppComponentInstance<facebook::react::RNSVGSvgViewShadowNode>,
|
|
20
|
-
public SvgHost {
|
|
28
|
+
public SvgHost , public SvgForeignObjectNodeDelegate {
|
|
21
29
|
public:
|
|
22
30
|
explicit RNSVGSvgViewComponentInstance(Context context);
|
|
23
31
|
~RNSVGSvgViewComponentInstance();
|
|
24
32
|
|
|
25
33
|
void onFinalizeUpdates() override;
|
|
26
|
-
|
|
34
|
+
void onDrawForeignImage(OH_PixelmapNative *foreignPixelMap,float width,float height,float x,float y) override;
|
|
27
35
|
// get SvgNode from childComponentInstance and set it to root_
|
|
28
36
|
void onChildInserted(ComponentInstance::Shared const &childComponentInstance, std::size_t index) override;
|
|
29
37
|
|
|
@@ -41,6 +49,7 @@ public:
|
|
|
41
49
|
private:
|
|
42
50
|
SvgArkUINode m_svgArkUINode;
|
|
43
51
|
std::shared_ptr<SvgSvg> m_svgSvg = std::make_shared<SvgSvg>();
|
|
52
|
+
int noSvgComponentIndex {0}; // 非svg添加的index(适配js侧view包裹会拆解子元素成平级)
|
|
44
53
|
};
|
|
45
54
|
|
|
46
55
|
} // namespace svg
|
package/harmony/svg.har
CHANGED
|
Binary file
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "LocalSvg", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _css.LocalSvg;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "SvgCss", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _css.SvgCss;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "SvgCssUri", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _css.SvgCssUri;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "SvgWithCss", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _css.SvgWithCss;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "SvgWithCssUri", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _css.SvgWithCssUri;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "WithLocalSvg", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _css.WithLocalSvg;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "inlineStyles", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return _css.inlineStyles;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "loadLocalRawResource", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () {
|
|
51
|
-
return _css.loadLocalRawResource;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
var _css = require("react-native-svg/css");
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "LocalSvg", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _css.LocalSvg;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "SvgCss", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _css.SvgCss;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "SvgCssUri", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _css.SvgCssUri;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "SvgWithCss", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _css.SvgWithCss;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "SvgWithCssUri", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _css.SvgWithCssUri;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "WithLocalSvg", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _css.WithLocalSvg;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "inlineStyles", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _css.inlineStyles;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "loadLocalRawResource", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _css.loadLocalRawResource;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
var _css = require("react-native-svg/css");
|
|
55
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_css","require"],"sourceRoot":"
|
|
1
|
+
{"version":3,"names":["_css","require"],"sourceRoot":"..\\..\\..\\src","sources":["css/index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _exportNames = {};
|
|
7
|
-
Object.defineProperty(exports, "default", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _ReactNativeSVG.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
var _ReactNativeSVG = _interopRequireWildcard(require("react-native-svg/src/ReactNativeSVG"));
|
|
14
|
-
Object.keys(_ReactNativeSVG).forEach(function (key) {
|
|
15
|
-
if (key === "default" || key === "__esModule") return;
|
|
16
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
17
|
-
if (key in exports && exports[key] === _ReactNativeSVG[key]) return;
|
|
18
|
-
Object.defineProperty(exports, key, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _ReactNativeSVG[key];
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {};
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _ReactNativeSVG.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _ReactNativeSVG = _interopRequireWildcard(require("react-native-svg/src/ReactNativeSVG"));
|
|
14
|
+
Object.keys(_ReactNativeSVG).forEach(function (key) {
|
|
15
|
+
if (key === "default" || key === "__esModule") return;
|
|
16
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
17
|
+
if (key in exports && exports[key] === _ReactNativeSVG[key]) return;
|
|
18
|
+
Object.defineProperty(exports, key, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _ReactNativeSVG[key];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
26
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ReactNativeSVG","_interopRequireWildcard","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","set","getOwnPropertyDescriptor"],"sourceRoot":"
|
|
1
|
+
{"version":3,"names":["_ReactNativeSVG","_interopRequireWildcard","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","set","getOwnPropertyDescriptor"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAJ,eAAA,EAAAK,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAN,eAAA,CAAAM,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAd,eAAA,CAAAM,GAAA;IAAA;EAAA;AAAA;AAAoD,SAAAL,wBAAAc,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAhB,uBAAA,YAAAA,CAAAc,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAP,GAAA,CAAAC,CAAA,GAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAR,cAAA,CAAAC,IAAA,CAAAM,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAlB,MAAA,CAAAS,cAAA,KAAAT,MAAA,CAAAyB,wBAAA,CAAAb,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAR,GAAA,IAAAQ,CAAA,CAAAK,GAAA,IAAAN,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA","ignoreList":[]}
|
package/lib/module/css/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SvgCss, SvgCssUri, SvgWithCss, SvgWithCssUri, inlineStyles } from 'react-native-svg/css';
|
|
2
|
-
import { LocalSvg, WithLocalSvg, loadLocalRawResource } from 'react-native-svg/css';
|
|
3
|
-
export { SvgCss, SvgCssUri, SvgWithCss, SvgWithCssUri, inlineStyles, LocalSvg, WithLocalSvg, loadLocalRawResource };
|
|
1
|
+
import { SvgCss, SvgCssUri, SvgWithCss, SvgWithCssUri, inlineStyles } from 'react-native-svg/css';
|
|
2
|
+
import { LocalSvg, WithLocalSvg, loadLocalRawResource } from 'react-native-svg/css';
|
|
3
|
+
export { SvgCss, SvgCssUri, SvgWithCss, SvgWithCssUri, inlineStyles, LocalSvg, WithLocalSvg, loadLocalRawResource };
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SvgCss","SvgCssUri","SvgWithCss","SvgWithCssUri","inlineStyles","LocalSvg","WithLocalSvg","loadLocalRawResource"],"sourceRoot":"
|
|
1
|
+
{"version":3,"names":["SvgCss","SvgCssUri","SvgWithCss","SvgWithCssUri","inlineStyles","LocalSvg","WithLocalSvg","loadLocalRawResource"],"sourceRoot":"..\\..\\..\\src","sources":["css/index.tsx"],"mappings":"AAAA,SACIA,MAAM,EACNC,SAAS,EACTC,UAAU,EACVC,aAAa,EACbC,YAAY,QACP,sBAAsB;AAE7B,SAASC,QAAQ,EAAEC,YAAY,EAAEC,oBAAoB,QAAQ,sBAAsB;AAEnF,SACEP,MAAM,EACNC,SAAS,EACTC,UAAU,EACVC,aAAa,EACbC,YAAY,EACZC,QAAQ,EACRC,YAAY,EACZC,oBAAoB","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from 'react-native-svg/src/ReactNativeSVG';
|
|
2
|
-
export { default } from 'react-native-svg/src/ReactNativeSVG';
|
|
1
|
+
export * from 'react-native-svg/src/ReactNativeSVG';
|
|
2
|
+
export { default } from 'react-native-svg/src/ReactNativeSVG';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["default"],"sourceRoot":"
|
|
1
|
+
{"version":3,"names":["default"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":"AAAA,cAAc,qCAAqC;AAEnD,SAASA,OAAO,QAAQ,qCAAqC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"babel.config.d.ts","sourceRoot":"","sources":["../../babel.config.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"babel.config.d.ts","sourceRoot":"","sources":["../../../example/babel.config.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../../example/contexts.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,gBAAgB,0BAAiC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hvigorfile.d.ts","sourceRoot":"","sources":["../../../../../example/harmony/entry/hvigorfile.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hvigorfile.d.ts","sourceRoot":"","sources":["../../../../example/harmony/hvigorfile.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../example/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest.config.d.ts","sourceRoot":"","sources":["../../../example/jest.config.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metro.config.d.ts","sourceRoot":"","sources":["../../../example/metro.config.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-native.config.d.ts","sourceRoot":"","sources":["../../../example/react-native.config.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-build-profile.d.ts","sourceRoot":"","sources":["../../../../example/scripts/create-build-profile.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../example/src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,CAAC,OAAO,UAAU,GAAG,sBAQ1B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SvgCss, SvgCssUri, SvgWithCss, SvgWithCssUri, inlineStyles } from 'react-native-svg/css';
|
|
2
|
+
import { LocalSvg, WithLocalSvg, loadLocalRawResource } from 'react-native-svg/css';
|
|
3
|
+
export { SvgCss, SvgCssUri, SvgWithCss, SvgWithCssUri, inlineStyles, LocalSvg, WithLocalSvg, loadLocalRawResource, };
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/css/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,MAAM,EACN,SAAS,EACT,UAAU,EACV,aAAa,EACb,YAAY,EACb,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEpF,OAAO,EACL,MAAM,EACN,SAAS,EACT,UAAU,EACV,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,oBAAoB,GACrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-ohos/react-native-svg",
|
|
3
|
-
"version": "15.12.1-rc.
|
|
3
|
+
"version": "15.12.1-rc.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"react-native": "src/index",
|
|
6
6
|
"main": "lib/commonjs/index",
|
|
7
7
|
"module": "lib/module/index",
|
|
8
8
|
"types": "lib/typescript/index.d.ts",
|
|
9
9
|
"scripts": {
|
|
10
|
+
"prepack": "bob build",
|
|
11
|
+
"prepublishOnly": "npm run prepack && react-native verify-package-harmony --package-path . --skip-checks oh_package_name_is_derived_from_npm_package_name",
|
|
10
12
|
"update_version": "node ./scripts/update-version.js",
|
|
11
13
|
"deploy": "node ./scripts/deploy.js",
|
|
12
14
|
"codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-svg --cpp-output-path ./harmony/svg/src/main/cpp/generated --ets-output-path ./harmony/svg/src/main/ets/generated --cpp-components-spec-paths ./node_modules/react-native-svg/src/fabric"
|
|
@@ -19,7 +21,7 @@
|
|
|
19
21
|
"react-native-svg": "15.12.0"
|
|
20
22
|
},
|
|
21
23
|
"devDependencies": {
|
|
22
|
-
"@
|
|
24
|
+
"@ohos/hvigor-ohos-plugin": "^6.20.0",
|
|
23
25
|
"@react-native-community/cli": "15.0.1",
|
|
24
26
|
"@tsconfig/react-native": "^3.0.0",
|
|
25
27
|
"@types/jest": "^29.5.1",
|
|
@@ -27,7 +29,7 @@
|
|
|
27
29
|
"@types/react": "^19.1.7",
|
|
28
30
|
"@types/react-native": "^0.71.6",
|
|
29
31
|
"react-native-builder-bob": "^0.20.4",
|
|
30
|
-
"typescript": "^5.
|
|
32
|
+
"typescript": "^5.2.2"
|
|
31
33
|
},
|
|
32
34
|
"harmony": {
|
|
33
35
|
"alias": "react-native-svg",
|
|
@@ -45,8 +47,7 @@
|
|
|
45
47
|
"output": "lib",
|
|
46
48
|
"targets": [
|
|
47
49
|
"commonjs",
|
|
48
|
-
"module"
|
|
49
|
-
"typescript"
|
|
50
|
+
"module"
|
|
50
51
|
]
|
|
51
52
|
}
|
|
52
53
|
}
|