@react-native-ohos/react-native-svg 15.12.1-rc.13 → 15.12.1-rc.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/harmony/svg/oh-package.json5 +1 -1
  2. package/harmony/svg/src/main/cpp/SvgForeignObjectNode.cpp +24 -13
  3. package/harmony/svg/src/main/cpp/SvgForeignObjectNode.h +5 -0
  4. package/package.json +2 -3
  5. package/harmony/svg.har +0 -0
  6. package/lib/typescript/babel.config.d.ts +0 -8
  7. package/lib/typescript/babel.config.d.ts.map +0 -1
  8. package/lib/typescript/example/babel.config.d.ts +0 -3
  9. package/lib/typescript/example/babel.config.d.ts.map +0 -1
  10. package/lib/typescript/example/contexts.d.ts +0 -3
  11. package/lib/typescript/example/contexts.d.ts.map +0 -1
  12. package/lib/typescript/example/harmony/entry/hvigorfile.d.ts +0 -2
  13. package/lib/typescript/example/harmony/entry/hvigorfile.d.ts.map +0 -1
  14. package/lib/typescript/example/harmony/hvigorfile.d.ts +0 -2
  15. package/lib/typescript/example/harmony/hvigorfile.d.ts.map +0 -1
  16. package/lib/typescript/example/index.d.ts +0 -2
  17. package/lib/typescript/example/index.d.ts.map +0 -1
  18. package/lib/typescript/example/jest.config.d.ts +0 -3
  19. package/lib/typescript/example/jest.config.d.ts.map +0 -1
  20. package/lib/typescript/example/metro.config.d.ts +0 -3
  21. package/lib/typescript/example/metro.config.d.ts.map +0 -1
  22. package/lib/typescript/example/react-native.config.d.ts +0 -3
  23. package/lib/typescript/example/react-native.config.d.ts.map +0 -1
  24. package/lib/typescript/example/scripts/create-build-profile.d.ts +0 -2
  25. package/lib/typescript/example/scripts/create-build-profile.d.ts.map +0 -1
  26. package/lib/typescript/example/src/index.d.ts +0 -3
  27. package/lib/typescript/example/src/index.d.ts.map +0 -1
  28. package/lib/typescript/src/css/index.d.ts +0 -4
  29. package/lib/typescript/src/css/index.d.ts.map +0 -1
  30. package/lib/typescript/src/index.d.ts +0 -3
  31. package/lib/typescript/src/index.d.ts.map +0 -1
@@ -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.13',
9
+ version: '15.12.1-rc.14',
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
  },
@@ -18,11 +18,10 @@
18
18
  * License for the specific language governing permissions and limitations
19
19
  * under the License.
20
20
  */
21
-
21
+ #include <dlfcn.h>
22
22
  #include "SvgForeignObjectNode.h"
23
23
  #include "RNOH/arkui/NativeNodeApi.h"
24
- #include <deviceinfo.h>
25
- #include <info/application_target_sdk_version.h>
24
+
26
25
  namespace rnoh {
27
26
  namespace svg {
28
27
  SvgForeignObjectNode::SvgForeignObjectNode()
@@ -66,19 +65,31 @@ void SvgForeignObjectNode::onNodeEvent(ArkUI_NodeEventType eventType, EventArgs
66
65
  }
67
66
 
68
67
  OH_PixelmapNative *SvgForeignObjectNode::GetNodePixelMap() {
69
- #ifdef OH_CURRENT_API_VERSION
70
- if (OH_CURRENT_API_VERSION < 15 || OH_GetSdkApiVersion() < 15) {
71
- LOG(ERROR) << "[svgForeignNode] current sdk or rom cannot support ForeignObject";
68
+ high_lib_handle = dlopen("libace_ndk.z.so", RTLD_LAZY);
69
+ if (high_lib_handle == NULL) {
70
+ DLOG(INFO) << "[svgForeignNode] libace_ndk.z.so not existed";
71
+ dlclose(high_lib_handle);
72
72
  return nullptr;
73
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;
74
+ createSnapshotOptionsMethod = (ArkUI_SnapshotOptions*(*)())dlsym(high_lib_handle, "OH_ArkUI_CreateSnapshotOptions");
75
+ snapshotOptionsSetScaleMethod = (int32_t(*)(ArkUI_SnapshotOptions*, float))dlsym(high_lib_handle, "OH_ArkUI_SnapshotOptions_SetScale");
76
+ getNodeSnapshotMethod = (int32_t(*)(ArkUI_NodeHandle, ArkUI_SnapshotOptions*, OH_PixelmapNative** ))dlsym(high_lib_handle, "OH_ArkUI_GetNodeSnapshot");
77
+
78
+ bool isCreateSnapshotOptionsMethodExisted = createSnapshotOptionsMethod != NULL;
79
+ bool isSnapshotOptionsSetScaleMethodExisted = snapshotOptionsSetScaleMethod != NULL;
80
+ bool isGetNodeSnapshotMethodExisted = getNodeSnapshotMethod != NULL;
81
+ if (isCreateSnapshotOptionsMethodExisted && isSnapshotOptionsSetScaleMethodExisted && isGetNodeSnapshotMethodExisted) {
82
+ DLOG(INFO) << "[svgForeignNode] method existed";
83
+ OH_PixelmapNative *pixelMap;
84
+ ArkUI_SnapshotOptions *options = createSnapshotOptionsMethod();
85
+ snapshotOptionsSetScaleMethod(options, 1);
86
+ int32_t code = getNodeSnapshotMethod(mStackNode.getArkUINodeHandle(), options, &pixelMap);
87
+ if (code == ARKUI_ERROR_CODE_NO_ERROR) {
88
+ dlclose(high_lib_handle);
89
+ return pixelMap;
90
+ }
80
91
  }
81
- #endif
92
+ dlclose(high_lib_handle);
82
93
  return nullptr;
83
94
  }
84
95
 
@@ -74,6 +74,11 @@ private:
74
74
  int _clipRule{0};
75
75
  float pointScaleFactor_{0};
76
76
  bool _isGeneratedPixelMap{false}; //防止快照生成多次,导致性能影响
77
+ void *high_lib_handle = NULL;
78
+ ArkUI_SnapshotOptions* (*createSnapshotOptionsMethod)();
79
+ int32_t (*snapshotOptionsSetScaleMethod)(ArkUI_SnapshotOptions* snapshotOptions, float scale);
80
+ int32_t (*getNodeSnapshotMethod)(ArkUI_NodeHandle node, ArkUI_SnapshotOptions* snapshotOptions,
81
+ OH_PixelmapNative** pixelmap);
77
82
  };
78
83
 
79
84
  } // namespace svg
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-ohos/react-native-svg",
3
- "version": "15.12.1-rc.13",
3
+ "version": "15.12.1-rc.14",
4
4
  "description": "",
5
5
  "react-native": "src/index",
6
6
  "main": "lib/commonjs/index",
@@ -46,8 +46,7 @@
46
46
  "output": "lib",
47
47
  "targets": [
48
48
  "commonjs",
49
- "module",
50
- "typescript"
49
+ "module"
51
50
  ]
52
51
  }
53
52
  }
package/harmony/svg.har DELETED
Binary file
@@ -1,8 +0,0 @@
1
- export let presets: string[];
2
- export let plugins: (string | {
3
- alias: {
4
- '@react-native-community/push-notification-ios': string;
5
- };
6
- cwd: string;
7
- })[][];
8
- //# sourceMappingURL=babel.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"babel.config.d.ts","sourceRoot":"","sources":["../../babel.config.js"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export let presets: string[];
2
- export let plugins: string[];
3
- //# sourceMappingURL=babel.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"babel.config.d.ts","sourceRoot":"","sources":["../../../example/babel.config.js"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const AppParamsContext: React.Context<undefined>;
3
- //# sourceMappingURL=contexts.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- export { hapTasks } from '@ohos/hvigor-ohos-plugin';
2
- //# sourceMappingURL=hvigorfile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hvigorfile.d.ts","sourceRoot":"","sources":["../../../../../example/harmony/entry/hvigorfile.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,2 +0,0 @@
1
- export { appTasks } from '@ohos/hvigor-ohos-plugin';
2
- //# sourceMappingURL=hvigorfile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hvigorfile.d.ts","sourceRoot":"","sources":["../../../../example/harmony/hvigorfile.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../example/index.js"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- declare const _exports: any;
2
- export = _exports;
3
- //# sourceMappingURL=jest.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jest.config.d.ts","sourceRoot":"","sources":["../../../example/jest.config.js"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- declare const _exports: any;
2
- export = _exports;
3
- //# sourceMappingURL=metro.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"metro.config.d.ts","sourceRoot":"","sources":["../../../example/metro.config.js"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export let project: {};
2
- export let assets: string[];
3
- //# sourceMappingURL=react-native.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-native.config.d.ts","sourceRoot":"","sources":["../../../example/react-native.config.js"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=create-build-profile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-build-profile.d.ts","sourceRoot":"","sources":["../../../../example/scripts/create-build-profile.js"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export default function App(): React.JSX.Element;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,4 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,3 +0,0 @@
1
- export * from 'react-native-svg/src/ReactNativeSVG';
2
- export { default } from 'react-native-svg/src/ReactNativeSVG';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}