@react-native-ohos/react-native-clippathview 1.1.9-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/LICENSE +21 -0
- package/README.md +15 -0
- package/harmony/clipPath/BuildProfile.ets +6 -0
- package/harmony/clipPath/LICENSE +21 -0
- package/harmony/clipPath/OAT.xml +39 -0
- package/harmony/clipPath/README.OpenSource +11 -0
- package/harmony/clipPath/ResourceTable.txt +0 -0
- package/harmony/clipPath/build-profile.json5 +11 -0
- package/harmony/clipPath/consumer-rules.txt +0 -0
- package/harmony/clipPath/hvigorfile.ts +6 -0
- package/harmony/clipPath/index.ets +15 -0
- package/harmony/clipPath/obfuscation-rules.txt +18 -0
- package/harmony/clipPath/oh-package.json5 +14 -0
- package/harmony/clipPath/src/main/cpp/CMakeLists.txt +7 -0
- package/harmony/clipPath/src/main/cpp/ClipPathProps.h +127 -0
- package/harmony/clipPath/src/main/cpp/ClipPathViewComponentInstance.cpp +102 -0
- package/harmony/clipPath/src/main/cpp/ClipPathViewComponentInstance.h +33 -0
- package/harmony/clipPath/src/main/cpp/ClipPathViewJSIBinder.h +60 -0
- package/harmony/clipPath/src/main/cpp/ClipPathViewNapiBinder.h +79 -0
- package/harmony/clipPath/src/main/cpp/ClipPathViewNoneComponentInstance.cpp +102 -0
- package/harmony/clipPath/src/main/cpp/ClipPathViewNoneComponentInstance.h +38 -0
- package/harmony/clipPath/src/main/cpp/ClipPathViewNoneJSIBinder.h +61 -0
- package/harmony/clipPath/src/main/cpp/ClipPathViewNoneNapiBinder.h +80 -0
- package/harmony/clipPath/src/main/cpp/ClipPathViewNoneNode.cpp +381 -0
- package/harmony/clipPath/src/main/cpp/ClipPathViewNoneNode.h +98 -0
- package/harmony/clipPath/src/main/cpp/ClipPathViewPackage.h +85 -0
- package/harmony/clipPath/src/main/cpp/ComponentDescriptors.h +30 -0
- package/harmony/clipPath/src/main/cpp/ModUtil.cpp +47 -0
- package/harmony/clipPath/src/main/cpp/ModUtil.h +36 -0
- package/harmony/clipPath/src/main/cpp/Props.cpp +95 -0
- package/harmony/clipPath/src/main/cpp/Props.h +108 -0
- package/harmony/clipPath/src/main/cpp/RNCClipPathTurboModule.cpp +38 -0
- package/harmony/clipPath/src/main/cpp/RNCClipPathTurboModule.h +37 -0
- package/harmony/clipPath/src/main/cpp/SVGPathParser.cpp +617 -0
- package/harmony/clipPath/src/main/cpp/SVGPathParser.h +71 -0
- package/harmony/clipPath/src/main/cpp/SVGViewBox.cpp +94 -0
- package/harmony/clipPath/src/main/cpp/SVGViewBox.h +32 -0
- package/harmony/clipPath/src/main/cpp/ShadowNodes.cpp +22 -0
- package/harmony/clipPath/src/main/cpp/ShadowNodes.h +41 -0
- package/harmony/clipPath/src/main/cpp/pen_style_node.h +10 -0
- package/harmony/clipPath/src/main/ets/ClipPathPackage.ts +46 -0
- package/harmony/clipPath/src/main/ets/ClipPathTurboModule.ts +32 -0
- package/harmony/clipPath/src/main/module.json5 +7 -0
- package/harmony/clipPath/src/main/resources/base/element/string.json +8 -0
- package/harmony/clipPath/src/main/resources/en_US/element/string.json +8 -0
- package/harmony/clipPath/src/main/resources/zh_CN/element/string.json +8 -0
- package/harmony/clipPath/ts.ts +26 -0
- package/harmony/clipPath.har +0 -0
- package/index.d.ts +58 -0
- package/index.js +5 -0
- package/package.json +64 -0
- package/react-native-clippath.podspec +30 -0
- package/src/ClipPath.android.js +7 -0
- package/src/ClipPath.ios.js +5 -0
- package/src/ClipPath.web.js +5 -0
- package/src/ClipPathH.android.js +6 -0
- package/src/ClipPathH.ios.js +5 -0
- package/src/ClipPathH.web.js +5 -0
- package/src/ClipPathMobile.js +6 -0
- package/src/ClipPathMobileN.js +6 -0
- package/src/ClipPathNativeComponent.ts +48 -0
- package/src/ClipPathWeb.js +345 -0
- package/src/demo.jpg +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
|
3
|
+
* Licensed under the Apache 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
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
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
|
+
*/
|
|
15
|
+
|
|
16
|
+
#include "SVGViewBox.h"
|
|
17
|
+
#include <math.h>
|
|
18
|
+
#include <native_drawing/drawing_matrix.h>
|
|
19
|
+
#include <native_drawing/drawing_rect.h>
|
|
20
|
+
#include <native_drawing/drawing_types.h>
|
|
21
|
+
#include "string"
|
|
22
|
+
#include "vector"
|
|
23
|
+
#include <glog/logging.h>
|
|
24
|
+
|
|
25
|
+
void rnoh::SVGViewBox::transform(OH_Drawing_Rect *vbRect, OH_Drawing_Rect *eRect, std::string align, int meetOrSlice,
|
|
26
|
+
float density, OH_Drawing_Matrix *result) {
|
|
27
|
+
|
|
28
|
+
double vbX = OH_Drawing_RectGetLeft(vbRect) * density;
|
|
29
|
+
double vbY = OH_Drawing_RectGetTop(vbRect) * density;
|
|
30
|
+
double vbX2 = OH_Drawing_RectGetRight(vbRect) * density;
|
|
31
|
+
double vbY2 = OH_Drawing_RectGetBottom(vbRect) * density;
|
|
32
|
+
double vbWidth = vbX2 - vbX;
|
|
33
|
+
double vbHeight = vbY2 - vbY;
|
|
34
|
+
|
|
35
|
+
// Let e-x, e-y, e-width, e-height be the position and size of the element respectively.
|
|
36
|
+
double eX = OH_Drawing_RectGetLeft(eRect);
|
|
37
|
+
double eY = OH_Drawing_RectGetTop(eRect);
|
|
38
|
+
double eWidth = OH_Drawing_RectGetWidth(eRect);
|
|
39
|
+
double eHeight = OH_Drawing_RectGetHeight(eRect);
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
// Initialize scale-x to e-width/vb-width.
|
|
43
|
+
double scaleX = eWidth / vbWidth;
|
|
44
|
+
|
|
45
|
+
// Initialize scale-y to e-height/vb-height.
|
|
46
|
+
double scaleY = eHeight / vbHeight;
|
|
47
|
+
|
|
48
|
+
// Initialize translate-x to e-x - (vb-x * scale-x).
|
|
49
|
+
// Initialize translate-y to e-y - (vb-y * scale-y).
|
|
50
|
+
double translateX = eX - (vbX * scaleX);
|
|
51
|
+
double translateY = eY - (vbY * scaleY);
|
|
52
|
+
|
|
53
|
+
// If align is 'none'
|
|
54
|
+
if (meetOrSlice == MOS_NONE) {
|
|
55
|
+
// Let scale be set the smaller value of scale-x and scale-y.
|
|
56
|
+
// Assign scale-x and scale-y to scale.
|
|
57
|
+
double scale = scaleX = scaleY = fmin(scaleX, scaleY);
|
|
58
|
+
|
|
59
|
+
translateX += (eWidth - vbWidth * scaleX) / 2.0;
|
|
60
|
+
translateY += (eHeight - vbHeight * scaleY) / 2.0;
|
|
61
|
+
|
|
62
|
+
} else {
|
|
63
|
+
// If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller.
|
|
64
|
+
// Otherwise, if align is not 'none' and meetOrSlice is 'slice', set the smaller of scale-x and scale-y to the
|
|
65
|
+
// larger.
|
|
66
|
+
if (align.compare("none") != 0 && meetOrSlice == MOS_MEET) {
|
|
67
|
+
scaleX = scaleY = fmin(scaleX, scaleY);
|
|
68
|
+
} else if (align.compare("none") != 0 && meetOrSlice == MOS_SLICE) {
|
|
69
|
+
scaleX = scaleY = fmax(scaleX, scaleY);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// If align contains 'xMid', add (e-width - vb-width * scale-x) / 2 to translate-x.
|
|
73
|
+
if (align.find("xMid") != std::string::npos) {
|
|
74
|
+
translateX += (eWidth - vbWidth * scaleX) / 2.0;
|
|
75
|
+
}
|
|
76
|
+
// If align contains 'xMax', add (e-width - vb-width * scale-x) to translate-x.
|
|
77
|
+
if (align.find("xMax") != std::string::npos) {
|
|
78
|
+
translateX += (eWidth - vbWidth * scaleX);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// If align contains 'yMid', add (e-height - vb-height * scale-y) / 2 to translate-y.
|
|
82
|
+
if (align.find("YMid") != std::string::npos) {
|
|
83
|
+
translateY += (eHeight - vbHeight * scaleY) / 2.0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// If align contains 'yMax', add (e-height - vb-height * scale-y) to translate-y.
|
|
87
|
+
if (align.find("YMax") != std::string::npos) {
|
|
88
|
+
translateY += (eHeight - vbHeight * scaleY);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
OH_Drawing_MatrixReset(result);
|
|
92
|
+
OH_Drawing_MatrixPostScale(result, (float)scaleX, (float)scaleY, 0.0f, 0.0f);
|
|
93
|
+
OH_Drawing_MatrixPostTranslate(result, (float)translateX, (float)translateY);
|
|
94
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
|
3
|
+
* Licensed under the Apache 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
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
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
|
+
*/
|
|
15
|
+
|
|
16
|
+
#ifndef HARMONY_SVGVIEWBOX_H
|
|
17
|
+
#define HARMONY_SVGVIEWBOX_H
|
|
18
|
+
|
|
19
|
+
#include <native_drawing/drawing_types.h>
|
|
20
|
+
#include <string>
|
|
21
|
+
|
|
22
|
+
namespace rnoh {
|
|
23
|
+
class SVGViewBox {
|
|
24
|
+
public:
|
|
25
|
+
static const int MOS_MEET = 0;
|
|
26
|
+
static const int MOS_SLICE = 1;
|
|
27
|
+
static const int MOS_NONE = 2;
|
|
28
|
+
static void transform(OH_Drawing_Rect *vbRect, OH_Drawing_Rect *eRect, std::string align, int meetOrSlice,
|
|
29
|
+
float density, OH_Drawing_Matrix *result);
|
|
30
|
+
};
|
|
31
|
+
}; // namespace rnoh
|
|
32
|
+
#endif // HARMONY_SVGVIEWBOX_H
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
|
3
|
+
* Licensed under the Apache 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
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
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
|
+
*/
|
|
15
|
+
|
|
16
|
+
namespace facebook {
|
|
17
|
+
namespace react {
|
|
18
|
+
|
|
19
|
+
extern const char RNCClipPathViewComponentName[] = "RNCClipPathView";
|
|
20
|
+
extern const char RNCClipPathViewNoneComponentName[] = "RNCClipPathViewNone";
|
|
21
|
+
} // namespace react
|
|
22
|
+
} // namespace facebook
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
|
3
|
+
* Licensed under the Apache 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
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
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
|
+
*/
|
|
15
|
+
|
|
16
|
+
#ifndef HARMONY_CLIP_PATH_VIEW_SRC_MAIN_CPP_SHADOWNODES_H
|
|
17
|
+
#define HARMONY_CLIP_PATH_VIEW_SRC_MAIN_CPP_SHADOWNODES_H
|
|
18
|
+
|
|
19
|
+
#pragma once
|
|
20
|
+
|
|
21
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
22
|
+
#include <react/renderer/components/view/ViewShadowNode.h>
|
|
23
|
+
#include <jsi/jsi.h>
|
|
24
|
+
#include "Props.h"
|
|
25
|
+
|
|
26
|
+
namespace facebook {
|
|
27
|
+
namespace react {
|
|
28
|
+
|
|
29
|
+
JSI_EXPORT extern const char RNCClipPathViewComponentName[];
|
|
30
|
+
JSI_EXPORT extern const char RNCClipPathViewNoneComponentName[];
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* `ShadowNode` for <RTNCenteredText> component.
|
|
34
|
+
*/
|
|
35
|
+
using RNCClipPathViewShadowNode =
|
|
36
|
+
ConcreteViewShadowNode<RNCClipPathViewComponentName, RNCClipPathViewProps, ViewEventEmitter>;
|
|
37
|
+
using RNCClipPathViewNoneShadowNode =
|
|
38
|
+
ConcreteViewShadowNode<RNCClipPathViewNoneComponentName, RNCClipPathViewNoneProps, ViewEventEmitter>;
|
|
39
|
+
} // namespace react
|
|
40
|
+
} // namespace facebook
|
|
41
|
+
#endif
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created on 2024/7/4.
|
|
3
|
+
//
|
|
4
|
+
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
|
|
5
|
+
// please include "napi/native_api.h".
|
|
6
|
+
|
|
7
|
+
typedef enum {
|
|
8
|
+
CLIP_PEN_STYLE_FILL = 1 << 0,
|
|
9
|
+
CLIP_PEN_STYLE_STROKE = 1 << 1,
|
|
10
|
+
} Clip_PenStyleType;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
|
|
26
|
+
import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
|
|
27
|
+
import { ClipPathTurboModule } from './ClipPathTurboModule';
|
|
28
|
+
|
|
29
|
+
class ClipPathTurboModulesFactory extends TurboModulesFactory {
|
|
30
|
+
createTurboModule(name: string): TurboModule | null {
|
|
31
|
+
if (name === 'RNCClipPathContext') {
|
|
32
|
+
return new ClipPathTurboModule(this.ctx);
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
hasTurboModule(name: string): boolean {
|
|
38
|
+
return name === 'RNCClipPathContext';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class ClipPathPackage extends RNPackage {
|
|
43
|
+
createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
|
|
44
|
+
return new ClipPathTurboModulesFactory(ctx);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { TurboModule } from "@rnoh/react-native-openharmony/ts";
|
|
26
|
+
import display from '@ohos.display';
|
|
27
|
+
|
|
28
|
+
export class ClipPathTurboModule extends TurboModule {
|
|
29
|
+
getDensity(): number {
|
|
30
|
+
return display.getDefaultDisplaySync().densityPixels;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export * from "./src/main/ets/ClipPathTurboModule"
|
|
26
|
+
export * from "./src/main/ets/ClipPathPackage"
|
|
Binary file
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Constructor, NativeMethods, ViewProps } from "react-native";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
interface ClipPathViewProps extends ViewProps {
|
|
6
|
+
svgKey?:string // web
|
|
7
|
+
d?:string
|
|
8
|
+
viewBox?:number[]
|
|
9
|
+
aspect?: 'meet' | 'slice' | 'none'
|
|
10
|
+
align?:'xMinYMin'|
|
|
11
|
+
'xMidYMin' |
|
|
12
|
+
'xMaxYMin' |
|
|
13
|
+
'xMinYMid' |
|
|
14
|
+
'xMidYMid' |
|
|
15
|
+
'xMaxYMid' |
|
|
16
|
+
'xMinYMax' |
|
|
17
|
+
'xMidYMax' |
|
|
18
|
+
'xMaxYMax' |
|
|
19
|
+
'none'
|
|
20
|
+
|
|
21
|
+
translateZ?:number
|
|
22
|
+
|
|
23
|
+
fillRule?: 'evenodd' | 'nonzero'
|
|
24
|
+
strokeWidth?:number
|
|
25
|
+
strokeStart?:number
|
|
26
|
+
strokeEnd?:number
|
|
27
|
+
strokeCap?:'butt' | 'round' | 'square'
|
|
28
|
+
strokeJoin?: 'bevel' | 'miter' | 'round'
|
|
29
|
+
strokeMiter?:number
|
|
30
|
+
|
|
31
|
+
// transformOrder?: "r-s-t" | "r-t-s" | "s-r-t" | "s-t-r" | "t-r-s" | "t-s-r"
|
|
32
|
+
|
|
33
|
+
transX?:number
|
|
34
|
+
transY?:number
|
|
35
|
+
transPercentageValue?:boolean
|
|
36
|
+
|
|
37
|
+
rot?:number
|
|
38
|
+
rotO?:number
|
|
39
|
+
rotOx?:number
|
|
40
|
+
rotOy?:number
|
|
41
|
+
rotPercentageValue?:boolean
|
|
42
|
+
|
|
43
|
+
sc?:number
|
|
44
|
+
scX?:number
|
|
45
|
+
scY?:number
|
|
46
|
+
scO?:number
|
|
47
|
+
scOx?:number
|
|
48
|
+
scOy?:number
|
|
49
|
+
scPercentageValue?:boolean
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare class ClipPathComponent extends React.Component<ClipPathViewProps> {}
|
|
54
|
+
declare const ClipPathViewBase: Constructor<NativeMethods> & typeof ClipPathComponent;
|
|
55
|
+
|
|
56
|
+
export class ClipPathViewH extends ClipPathViewBase {}
|
|
57
|
+
export class ClipPathView extends ClipPathViewBase {}
|
|
58
|
+
|
package/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import {Platfotm} from 'react-native'
|
|
2
|
+
import ClipPathViewNoneAndroid from './src/ClipPathH.android.js'
|
|
3
|
+
import ClipPathViewAndroid from './src/ClipPath.android.js'
|
|
4
|
+
export const ClipPathView = ClipPathViewAndroid;
|
|
5
|
+
export const ClipPathViewH = ClipPathViewNoneAndroid;
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-native-ohos/react-native-clippathview",
|
|
3
|
+
"title": "React Native ClipPath",
|
|
4
|
+
"version": "1.1.9-rc.1",
|
|
5
|
+
"description": "ClipPath Android Web IOS Harmony",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"types": "index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"harmony",
|
|
10
|
+
"README.md",
|
|
11
|
+
"index.js",
|
|
12
|
+
"src",
|
|
13
|
+
"index.d.ts",
|
|
14
|
+
"react-native-clippath.podspec"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/react-native-oh-library/react-native-clippath.git",
|
|
22
|
+
"baseUrl": "https://github.com/react-native-oh-library/react-native-clippath"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"harmony",
|
|
26
|
+
"react-native",
|
|
27
|
+
"clippath",
|
|
28
|
+
"clip",
|
|
29
|
+
"react",
|
|
30
|
+
"android",
|
|
31
|
+
"ios",
|
|
32
|
+
"web",
|
|
33
|
+
"path",
|
|
34
|
+
"shape",
|
|
35
|
+
"GPU",
|
|
36
|
+
"Hardware accelerated"
|
|
37
|
+
],
|
|
38
|
+
"author": {
|
|
39
|
+
"name": "Juan J LF",
|
|
40
|
+
"email": "justinjlf21@gmail.com"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"registry": "https://registry.npmjs.org/",
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"licenseFilename": "LICENSE",
|
|
48
|
+
"readmeFilename": "README.md",
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"react": ">=16.8.1",
|
|
51
|
+
"react-native": ">=0.60.0-rc.0 <1.0.x"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"react": "*",
|
|
55
|
+
"react-native": "*"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"react-native-clippathview": "1.1.8",
|
|
59
|
+
"svgpath": "^2.3.1"
|
|
60
|
+
},
|
|
61
|
+
"harmony": {
|
|
62
|
+
"alias": "react-native-clippathview"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# react-native-clippath.podspec
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
6
|
+
|
|
7
|
+
Pod::Spec.new do |s|
|
|
8
|
+
s.name = "react-native-clippath"
|
|
9
|
+
s.version = package["version"]
|
|
10
|
+
s.summary = package["description"]
|
|
11
|
+
s.description = <<-DESC
|
|
12
|
+
ClipPath IOS
|
|
13
|
+
DESC
|
|
14
|
+
s.homepage = "https://github.com/Only-IceSoul/react-native-clippath"
|
|
15
|
+
# brief license entry:
|
|
16
|
+
s.license = "MIT"
|
|
17
|
+
# optional - use expanded license entry instead:
|
|
18
|
+
# s.license = { :type => "MIT", :file => "LICENSE" }
|
|
19
|
+
s.authors = { "Your Name" => "yourname@email.com" }
|
|
20
|
+
s.platforms = { :ios => "10.0" }
|
|
21
|
+
s.source = { :git => "https://github.com/Only-IceSoul/react-native-clippath.git", :tag => "#{s.version}" }
|
|
22
|
+
|
|
23
|
+
s.source_files = "ios/**/*.{h,c,cc,cpp,m,mm,swift}"
|
|
24
|
+
s.requires_arc = true
|
|
25
|
+
|
|
26
|
+
s.dependency "React"
|
|
27
|
+
# ...
|
|
28
|
+
# s.dependency "..."
|
|
29
|
+
end
|
|
30
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
|
|
3
|
+
import type { ViewProps } from "react-native/Libraries/Components/View/ViewPropTypes";
|
|
4
|
+
import type { HostComponent } from "react-native";
|
|
5
|
+
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
|
|
6
|
+
import { Int32, WithDefault, Float } from "react-native/Libraries/Types/CodegenTypes"
|
|
7
|
+
|
|
8
|
+
export interface NativeProps extends ViewProps {
|
|
9
|
+
color?: string;
|
|
10
|
+
openClip?: WithDefault<boolean, true>;
|
|
11
|
+
fill?: WithDefault<string, ''>;
|
|
12
|
+
stroke?: WithDefault<string, ''>;
|
|
13
|
+
showProperty?: WithDefault<boolean, false>;
|
|
14
|
+
|
|
15
|
+
svgKey?: string;
|
|
16
|
+
d?: string;
|
|
17
|
+
viewBox?: Array<Int32>;
|
|
18
|
+
align?: WithDefault<string, 'xMidYMid'>;
|
|
19
|
+
aspect?: WithDefault<string, 'meet'>;
|
|
20
|
+
fillRule?: WithDefault<string, 'nonzero'>;
|
|
21
|
+
strokeWidth?: WithDefault<Int32, 1>;
|
|
22
|
+
strokeCap?: WithDefault<string, 'butt'>;
|
|
23
|
+
strokeJoin?: WithDefault<string, 'miter'>;
|
|
24
|
+
strokeMiter?: WithDefault<Int32, 4>;
|
|
25
|
+
strokeStart?: WithDefault<Int32, 0>;
|
|
26
|
+
strokeEnd?: WithDefault<Int32, 1>;
|
|
27
|
+
// children?: React.ReactElement;
|
|
28
|
+
translateZ?: WithDefault<Int32, 0>;
|
|
29
|
+
transX?: WithDefault<Int32, 0>;
|
|
30
|
+
transY?: WithDefault<Int32, 0>;
|
|
31
|
+
transPercentageValue?: WithDefault<boolean, false>;
|
|
32
|
+
rot?: WithDefault<Int32, 0>;
|
|
33
|
+
rotO?: WithDefault<Int32, 0>;
|
|
34
|
+
rotOx?: WithDefault<Int32, 0>;
|
|
35
|
+
rotOy?: WithDefault<Int32, 0>;
|
|
36
|
+
rotPercentageValue?: WithDefault<boolean, false>;
|
|
37
|
+
sc?: WithDefault<Float, 1>;
|
|
38
|
+
scX?: WithDefault<Float, 1>;
|
|
39
|
+
scY?: WithDefault<Float, 1>;
|
|
40
|
+
scO?: WithDefault<Int32, 0>;
|
|
41
|
+
scOx?: WithDefault<Int32, 0>;
|
|
42
|
+
scOy?: WithDefault<Int32, 0>;
|
|
43
|
+
scPercentageValue?: WithDefault<boolean, false>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default codegenNativeComponent<NativeProps>(
|
|
47
|
+
"ClipPath"
|
|
48
|
+
) as HostComponent<NativeProps>;
|