@react-native-ohos/react-native-map-clustering 3.4.1-rc.1 → 3.5.0

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 (55) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/COMMITTERS.md +6 -0
  3. package/LICENSE +21 -21
  4. package/OAT.xml +57 -57
  5. package/README.OpenSource +10 -10
  6. package/README.md +13 -13
  7. package/example/.eslintrc +19 -0
  8. package/example/.node-version +6 -0
  9. package/example/.prettierrc.js +7 -0
  10. package/example/.watchmanconfig +6 -0
  11. package/example/app.json +4 -0
  12. package/example/babel.config.js +6 -0
  13. package/example/contexts.ts +9 -0
  14. package/example/harmony/AppScope/app.json5 +10 -0
  15. package/example/harmony/AppScope/resources/base/element/string.json +8 -0
  16. package/example/harmony/AppScope/resources/base/media/app_icon.png +0 -0
  17. package/example/harmony/build-profile.template.json5 +36 -0
  18. package/example/harmony/codelinter.json +32 -0
  19. package/example/harmony/entry/build-profile.json5 +22 -0
  20. package/example/harmony/entry/hvigorfile.ts +8 -0
  21. package/example/harmony/entry/oh-package.json5 +11 -0
  22. package/example/harmony/entry/src/main/cpp/CMakeLists.txt +42 -0
  23. package/example/harmony/entry/src/main/cpp/PackageProvider.cpp +17 -0
  24. package/example/harmony/entry/src/main/ets/RNPackagesFactory.ets +15 -0
  25. package/example/harmony/entry/src/main/ets/assets/fonts/Pacifico-Regular.ttf +0 -0
  26. package/example/harmony/entry/src/main/ets/assets/fonts/StintUltraCondensed-Regular.ttf +0 -0
  27. package/example/harmony/entry/src/main/ets/entryability/EntryAbility.ets +27 -0
  28. package/example/harmony/entry/src/main/ets/pages/Index.ets +209 -0
  29. package/example/harmony/entry/src/main/ets/pages/SurfaceDeadlockTest.ets +135 -0
  30. package/example/harmony/entry/src/main/ets/pages/TouchDisplayer.ets +44 -0
  31. package/example/harmony/entry/src/main/module.json5 +72 -0
  32. package/example/harmony/entry/src/main/resources/base/element/color.json +8 -0
  33. package/example/harmony/entry/src/main/resources/base/element/string.json +20 -0
  34. package/example/harmony/entry/src/main/resources/base/media/icon.png +0 -0
  35. package/example/harmony/entry/src/main/resources/base/profile/main_pages.json +5 -0
  36. package/example/harmony/entry/src/main/resources/rawfile/1.txt +1 -0
  37. package/example/harmony/format.ps1 +18 -0
  38. package/example/harmony/hvigor/hvigor-config.json5 +21 -0
  39. package/example/harmony/hvigorfile.ts +9 -0
  40. package/example/harmony/oh-package.json5 +12 -0
  41. package/example/index.js +11 -0
  42. package/example/jest.config.js +11 -0
  43. package/example/metro.config.js +30 -0
  44. package/example/package.json +61 -0
  45. package/example/react-native.config.js +11 -0
  46. package/example/scripts/create-build-profile.js +46 -0
  47. package/example/src/App.tsx +186 -0
  48. package/example/src/Navigation.tsx +163 -0
  49. package/example/src/index.tsx +59 -0
  50. package/example/tsconfig.json +14 -0
  51. package/index.d.ts +40 -40
  52. package/index.js +2 -2
  53. package/lib/ClusterHarmony.js +21 -21
  54. package/lib/ClusteredMapView.js +310 -310
  55. package/package.json +42 -42
@@ -0,0 +1,209 @@
1
+ /*
2
+ * Copyright (c) 2024 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
+
7
+ import {
8
+ AnyJSBundleProvider,
9
+ ComponentBuilderContext,
10
+ FileJSBundleProvider,
11
+ MetroJSBundleProvider,
12
+ ResourceJSBundleProvider,
13
+ RNApp,
14
+ RNOHErrorDialog,
15
+ RNOHLogger,
16
+ TraceJSBundleProviderDecorator,
17
+ RNOHCoreContext
18
+ } from '@rnoh/react-native-openharmony';
19
+ import font from '@ohos.font';
20
+ import { createRNPackages } from '../RNPackagesFactory';
21
+ import { AIRMap, AIR_MAP_TYPE, AIRMapMarker, AIR_MAP_MARKER_TYPE, AIRMapPolyline, AIR_MAP_POLYLINE_TYPE, AIRMapPolygon,
22
+ AIR_MAP_POLYGON_TYPE, AIRMapCircle, AIR_MAP_CIRCLE_TYPE, AIR_MAP_CALLOUT_SUBVIEW_TYPE, AIR_MAP_CALLOUT_TYPE,
23
+ AIRMapCallout,
24
+ AIRMapCalloutSubview,
25
+ Geojson,
26
+ AIR_GEOJSON_TYPE,
27
+ AIRMapUrlTile,
28
+ AIR_URLTILE_TYPE,
29
+ AIRMapWMSTile,
30
+ AIR_WMSTILE_TYPE,
31
+ AIR_OVERLAY_TYPE,
32
+ AIRMapOverlay,
33
+ AIR_MAP_CLUSTER_TYPE,
34
+ AIRMapCluster,
35
+ } from "@react-native-ohos/react-native-maps"
36
+ const arkTsComponentNames: Array<string> = [
37
+ AIR_MAP_TYPE,
38
+ AIR_MAP_MARKER_TYPE,
39
+ AIR_MAP_POLYLINE_TYPE,
40
+ AIR_MAP_POLYGON_TYPE,
41
+ AIR_MAP_CIRCLE_TYPE,
42
+ AIR_MAP_CALLOUT_TYPE,
43
+ AIR_GEOJSON_TYPE,
44
+ AIR_URLTILE_TYPE,
45
+ AIR_WMSTILE_TYPE,
46
+ AIR_OVERLAY_TYPE,
47
+ AIR_MAP_CLUSTER_TYPE,
48
+ ];
49
+
50
+ @Builder
51
+ export function buildCustomRNComponent(ctx: ComponentBuilderContext) {
52
+ // There seems to be a problem with the placement of ArkTS components in mixed mode. Nested Stack temporarily avoided.
53
+ Stack() {
54
+ if (ctx.componentName === AIR_MAP_TYPE) {
55
+ AIRMap({
56
+ ctx: ctx.rnComponentContext,
57
+ tag: ctx.tag,
58
+ })
59
+ }else if (ctx.componentName === AIR_MAP_MARKER_TYPE) {
60
+ AIRMapMarker({
61
+ ctx: ctx.rnComponentContext,
62
+ tag: ctx.tag,
63
+ })
64
+ }else if (ctx.componentName === AIR_MAP_POLYLINE_TYPE) {
65
+ AIRMapPolyline({
66
+ ctx: ctx.rnComponentContext,
67
+ tag: ctx.tag,
68
+ })
69
+ }else if (ctx.componentName === AIR_MAP_POLYGON_TYPE) {
70
+ AIRMapPolygon({
71
+ ctx: ctx.rnComponentContext,
72
+ tag: ctx.tag,
73
+ })
74
+ }else if (ctx.componentName === AIR_MAP_CIRCLE_TYPE) {
75
+ AIRMapCircle({
76
+ ctx: ctx.rnComponentContext,
77
+ tag: ctx.tag,
78
+ })
79
+ }else if (ctx.componentName === AIR_MAP_CALLOUT_TYPE) {
80
+ AIRMapCallout({
81
+ ctx: ctx.rnComponentContext,
82
+ tag: ctx.tag,
83
+ })
84
+ }else if (ctx.componentName === AIR_MAP_CALLOUT_SUBVIEW_TYPE) {
85
+ AIRMapCalloutSubview({
86
+ ctx: ctx.rnComponentContext,
87
+ tag: ctx.tag,
88
+ })
89
+ }else if (ctx.componentName === AIR_MAP_CALLOUT_SUBVIEW_TYPE) {
90
+ AIRMapCalloutSubview({
91
+ ctx: ctx.rnComponentContext,
92
+ tag: ctx.tag,
93
+ })
94
+ }else if (ctx.componentName === AIR_GEOJSON_TYPE) {
95
+ Geojson({
96
+ ctx: ctx.rnComponentContext,
97
+ tag: ctx.tag,
98
+ })
99
+ }else if (ctx.componentName === AIR_URLTILE_TYPE) {
100
+ AIRMapUrlTile({
101
+ ctx: ctx.rnComponentContext,
102
+ tag: ctx.tag,
103
+ })
104
+ }else if (ctx.componentName === AIR_WMSTILE_TYPE) {
105
+ AIRMapWMSTile({
106
+ ctx: ctx.rnComponentContext,
107
+ tag: ctx.tag,
108
+ })
109
+ }else if (ctx.componentName === AIR_OVERLAY_TYPE) {
110
+ AIRMapOverlay({
111
+ ctx: ctx.rnComponentContext,
112
+ tag: ctx.tag,
113
+ })
114
+ } else if (ctx.componentName === AIR_MAP_CLUSTER_TYPE) {
115
+ AIRMapCluster({
116
+ ctx: ctx.rnComponentContext,
117
+ tag: ctx.tag,
118
+ })
119
+ }
120
+ }
121
+ .position({ x: 0, y: 0 })
122
+
123
+ }
124
+
125
+ const wrappedCustomRNComponentBuilder = wrapBuilder(buildCustomRNComponent)
126
+
127
+ /**
128
+ * If you want to use custom fonts, you need to register them here.
129
+ * We should support react-native-asset to handle registering fonts automatically.
130
+ */
131
+ const fonts: font.FontOptions[] = [
132
+ {
133
+ familyName: 'Pacifico-Regular',
134
+ familySrc: '/assets/fonts/Pacifico-Regular.ttf'
135
+ },
136
+ {
137
+ familyName: 'StintUltraCondensed-Regular',
138
+ familySrc: '/assets/fonts/StintUltraCondensed-Regular.ttf'
139
+ }
140
+ ]
141
+
142
+ @Entry
143
+ @Component
144
+ struct Index {
145
+ @StorageLink('RNOHCoreContext') private rnohCoreContext: RNOHCoreContext | undefined = undefined
146
+ @State shouldShow: boolean = false
147
+ private logger!: RNOHLogger
148
+ bundlePath: string = 'bunlde.harmony.js'
149
+ @State hasBundle: boolean = false
150
+
151
+ aboutToAppear() {
152
+ this.logger = this.rnohCoreContext!.logger.clone("Index")
153
+ const stopTracing = this.logger.clone("aboutToAppear").startTracing()
154
+ for (const customFont of fonts) {
155
+ font.registerFont(customFont)
156
+ }
157
+
158
+ this.shouldShow = true
159
+ stopTracing()
160
+ }
161
+
162
+ onBackPress(): boolean | undefined {
163
+ // NOTE: this is required since `Ability`'s `onBackPressed` function always
164
+ // terminates or puts the app in the background, but we want Ark to ignore it completely
165
+ // when handled by RN
166
+ this.rnohCoreContext!.dispatchBackPress()
167
+ return true
168
+ }
169
+
170
+ build() {
171
+ Column() {
172
+ if (this.rnohCoreContext && this.shouldShow) {
173
+ if (this.rnohCoreContext?.isDebugModeEnabled) {
174
+ RNOHErrorDialog({ ctx: this.rnohCoreContext })
175
+ }
176
+ RNApp({
177
+ rnInstanceConfig: {
178
+ createRNPackages,
179
+ enableNDKTextMeasuring: true,
180
+ enableBackgroundExecutor: false,
181
+ enableCAPIArchitecture: true,
182
+ arkTsComponentNames: arkTsComponentNames,
183
+ },
184
+ initialProps: { "foo": "bar" } as Record<string, string>,
185
+ appKey: "app_name",
186
+ wrappedCustomRNComponentBuilder: wrappedCustomRNComponentBuilder,
187
+ onSetUp: (rnInstance) => {
188
+ rnInstance.enableFeatureFlag("ENABLE_RN_INSTANCE_CLEAN_UP")
189
+ },
190
+ jsBundleProvider: new TraceJSBundleProviderDecorator(
191
+ new AnyJSBundleProvider([
192
+ new MetroJSBundleProvider(),
193
+ // NOTE: to load the bundle from file, place it in
194
+ // `/data/app/el2/100/base/com.rnoh.tester/files/bundle.harmony.js`
195
+ // on your device. The path mismatch is due to app sandboxing on HarmonyOS
196
+ new FileJSBundleProvider('/data/storage/el2/base/files/bundle.harmony.js'),
197
+ // new FileJSBundleProvider(context.filesDir '/' this.bundlePath),
198
+ new ResourceJSBundleProvider(this.rnohCoreContext.uiAbilityContext.resourceManager, 'hermes_bundle.hbc'),
199
+ new ResourceJSBundleProvider(this.rnohCoreContext.uiAbilityContext.resourceManager, 'bundle.harmony.js')
200
+ ]),
201
+ this.rnohCoreContext.logger),
202
+ })
203
+ }
204
+ Text("1233333333122 1212323")
205
+ }
206
+ .height('100%')
207
+ .width('100%')
208
+ }
209
+ }
@@ -0,0 +1,135 @@
1
+ /*
2
+ * Copyright (c) 2024 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
+ import { RNInstance, JSBundleProvider, RNAbility, RNSurface } from '@rnoh/react-native-openharmony'
7
+ import { CustomComponentBuilder } from "@rnoh/react-native-openharmony/src/main/ets/RNOHCorePackage"
8
+ import { SurfaceConfig2 } from '@rnoh/react-native-openharmony/src/main/ets/RNSurface'
9
+
10
+
11
+ @Component
12
+ export struct SurfaceDeadlockTest {
13
+ public jsBundleProvider: JSBundleProvider | undefined = undefined
14
+ public appKeys: string[] = []
15
+ public numberOfIterations: number = 1
16
+ @BuilderParam public buildCustomComponent!: CustomComponentBuilder
17
+ // -------------------------------------------------------------------------------------------------------------------
18
+ @StorageLink('RNAbility') private rnAbility: RNAbility = {} as RNAbility
19
+ private rnInstance!: RNInstance
20
+ @State private shouldShow: boolean = false
21
+ private shouldDestroyRNInstance: boolean = false
22
+ private cleanUpCallbacks: (() => void)[] = []
23
+
24
+ aboutToAppear() {
25
+ this.getOrCreateRNInstance().then(rnInstance => {
26
+ this.rnInstance = rnInstance
27
+ const jsBundleExecutionStatus = this.rnInstance.getBundleExecutionStatus(this.jsBundleProvider?.getURL())
28
+ if (this.jsBundleProvider && jsBundleExecutionStatus === undefined) {
29
+ this.rnInstance.runJSBundle(this.jsBundleProvider).then(() => {
30
+ this.shouldShow = true
31
+ })
32
+ return;
33
+ }
34
+ }).catch((reason: string | Error) => {
35
+ if (typeof reason === "string")
36
+ this.rnAbility.getLogger().error(reason)
37
+ else if (reason instanceof Error) {
38
+ this.rnAbility.getLogger().error(reason.message)
39
+ } else {
40
+ this.rnAbility.getLogger().error("Fatal exception")
41
+ }
42
+ })
43
+ }
44
+
45
+ aboutToDisappear() {
46
+ if (this.shouldDestroyRNInstance)
47
+ this.rnAbility.destroyAndUnregisterRNInstance(this.rnInstance)
48
+ this.cleanUpCallbacks.forEach(cleanUp => cleanUp())
49
+ }
50
+
51
+ private getOrCreateRNInstance(): Promise<RNInstance> {
52
+ return this.rnAbility.createAndRegisterRNInstance({ createRNPackages: () => [] })
53
+ }
54
+
55
+ build() {
56
+ Stack() {
57
+ if (this.shouldShow) {
58
+ ForEach(this.appKeys, (appKey: string, idx) => {
59
+ Stack() {
60
+ Blinker({
61
+ minDelayInMs: 1000,
62
+ maxDelayInMs: 2000,
63
+ blinksCount: this.numberOfIterations,
64
+ randomnessPrecisionInMs: 500
65
+ }) {
66
+ RNSurface({
67
+ ctx: this.rnAbility.createRNOHContext({ rnInstance: this.rnInstance }),
68
+ surfaceConfig: {
69
+ initialProps: {},
70
+ appKey: appKey,
71
+ } as SurfaceConfig2,
72
+ buildCustomComponent: this.buildCustomComponent,
73
+ })
74
+ }
75
+ }.height(`${100 / this.appKeys.length}%`)
76
+ .position({ x: 0, y: `${(idx / this.appKeys.length) * 100}%` })
77
+ })
78
+ }
79
+ }.width("100%")
80
+ .height("100%")
81
+ }
82
+ }
83
+
84
+
85
+ @Component
86
+ struct Blinker {
87
+ public minDelayInMs: number = 0
88
+ public maxDelayInMs: number = 1000
89
+ public blinksCount: number = 0
90
+ public randomnessPrecisionInMs: number = 250
91
+ @BuilderParam public renderChildren: () => void
92
+ private currentBlinksCount = 0
93
+ @State private isVisible: boolean = false
94
+ private timeout: number = 0
95
+
96
+ aboutToAppear() {
97
+ this.blink(this.minDelayInMs)
98
+ }
99
+
100
+ aboutToDisappear() {
101
+ clearTimeout(this.timeout)
102
+ }
103
+
104
+ private blink(ms: number) {
105
+ this.isVisible = !this.isVisible
106
+ this.currentBlinksCount += 1
107
+ if (this.currentBlinksCount >= this.blinksCount) {
108
+ if (this.timeout) {
109
+ clearTimeout(this.timeout)
110
+ }
111
+ this.isVisible = true
112
+ return;
113
+ }
114
+ this.timeout = setTimeout(() => {
115
+ this.blink(this.getNextDelay())
116
+ }, ms)
117
+ }
118
+
119
+ private getNextDelay(): number {
120
+ return ((Math.floor(Math.random() * (Number.MAX_VALUE / this.randomnessPrecisionInMs)) * this.randomnessPrecisionInMs) % this.maxDelayInMs) + this.minDelayInMs
121
+ }
122
+
123
+ build() {
124
+ Stack() {
125
+ if (this.isVisible) {
126
+ this.renderChildren()
127
+ }
128
+ }
129
+ }
130
+ }
131
+
132
+
133
+
134
+
135
+
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Copyright (c) 2024 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
+
7
+
8
+ @Component
9
+ export struct TouchDisplayer {
10
+ @State currentTouches: TouchObject[] = []
11
+ @State touchIndicatorOpacity: number = 0
12
+ @BuilderParam buildChildren: () => void
13
+ build() {
14
+ Stack() {
15
+ this.buildChildren()
16
+ ForEach(this.currentTouches, (activeTouch: TouchObject) => {
17
+ Stack() {
18
+ }
19
+ .width(64)
20
+ .height(64)
21
+ .backgroundColor("blue")
22
+ .borderWidth(2)
23
+ .borderColor("white")
24
+ .opacity(this.touchIndicatorOpacity)
25
+ .position({ x: activeTouch.x - 32, y: activeTouch.y - 32 })
26
+ .borderRadius(1000)
27
+ .hitTestBehavior(HitTestMode.Transparent)
28
+ })
29
+ }
30
+ .width("100%")
31
+ .height("100%")
32
+ .hitTestBehavior(HitTestMode.Transparent)
33
+ .onTouch(e => {
34
+ this.currentTouches = e.touches
35
+ this.touchIndicatorOpacity = 0.5
36
+ animateTo({
37
+ duration: 500,
38
+ curve: Curve.Linear,
39
+ }, () => {
40
+ this.touchIndicatorOpacity = 0
41
+ })
42
+ })
43
+ }
44
+ }
@@ -0,0 +1,72 @@
1
+ {
2
+ "module": {
3
+ "name": "entry",
4
+ "type": "entry",
5
+ "description": "$string:module_desc",
6
+ "mainElement": "EntryAbility",
7
+ "deviceTypes": [
8
+ "default"
9
+ ],
10
+ "querySchemes": [
11
+ "weixin",
12
+ ],
13
+ "deliveryWithInstall": true,
14
+ "installationFree": false,
15
+ "pages": "$profile:main_pages",
16
+ // below property is supported from 5.0.0 - it is needed by bundleManager.canOpenLink to check if the app can open some url
17
+ // "querySchemes": ["maps", "http", "https", "customDomain"],
18
+ "requestPermissions": [
19
+ {
20
+ "name": "ohos.permission.INTERNET"
21
+ },
22
+ {
23
+ "name": "ohos.permission.APPROXIMATELY_LOCATION",
24
+ "reason": "$string:Access_maps",
25
+ "usedScene": {
26
+ "abilities": [
27
+ "EntryAbility"
28
+ ],
29
+ "when": "always"
30
+ }
31
+ },
32
+ {
33
+ "name": "ohos.permission.LOCATION",
34
+ "reason": "$string:Access_maps",
35
+ "usedScene": {
36
+ "abilities": [
37
+ "EntryAbility"
38
+ ],
39
+ "when": "always"
40
+ }
41
+ },
42
+ ],
43
+ "metadata": [
44
+ {
45
+ "name": "client_id",
46
+ "value": "6917577711694136089",
47
+ }
48
+ ],
49
+ "abilities": [
50
+ {
51
+ "name": "EntryAbility",
52
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
53
+ "description": "$string:EntryAbility_desc",
54
+ "icon": "$media:icon",
55
+ "label": "$string:EntryAbility_label",
56
+ "startWindowIcon": "$media:icon",
57
+ "startWindowBackground": "$color:start_window_background",
58
+ "visible": true,
59
+ "skills": [
60
+ {
61
+ "entities": [
62
+ "entity.system.home"
63
+ ],
64
+ "actions": [
65
+ "action.system.home"
66
+ ]
67
+ }
68
+ ]
69
+ }
70
+ ]
71
+ }
72
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "color": [
3
+ {
4
+ "name": "start_window_background",
5
+ "value": "#FFFFFF"
6
+ }
7
+ ]
8
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "string": [
3
+ {
4
+ "name": "module_desc",
5
+ "value": "module description"
6
+ },
7
+ {
8
+ "name": "EntryAbility_desc",
9
+ "value": "description"
10
+ },
11
+ {
12
+ "name": "EntryAbility_label",
13
+ "value": "RN Tester"
14
+ },
15
+ {
16
+ "name": "Access_maps",
17
+ "value": "access maps"
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "src": [
3
+ "pages/Index"
4
+ ]
5
+ }
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright (c) 2024 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
+
7
+ $directoryPath = Split-Path -Parent $MyInvocation.MyCommand.Path
8
+ $filePaths = Get-ChildItem $directoryPath -Recurse -Include *.h, *.cpp |
9
+ Where-Object {
10
+ $_.DirectoryName -notmatch 'third-party' -and
11
+ $_.DirectoryName -notmatch 'patches' -and
12
+ $_.DirectoryName -notmatch 'node_modules' -and
13
+ $_.DirectoryName -notmatch '.cxx' -and
14
+ $_.DirectoryName -notmatch 'build'
15
+ }
16
+ foreach ($filePath in $filePaths) {
17
+ & "clang-format.exe" -style=file -i $filePath.FullName
18
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "modelVersion": "5.0.0",
3
+ "dependencies": {
4
+ },
5
+ "execution": {
6
+ // "analyze": "default", /* Define the build analyze mode. Value: [ "default" | "verbose" | false ]. Default: "default" */
7
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
8
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
9
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
10
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
11
+ },
12
+ "logging": {
13
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
14
+ },
15
+ "debugging": {
16
+ "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
17
+ },
18
+ "nodeOptions": {
19
+ // "maxOldSpaceSize": 4096 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process */
20
+ }
21
+ }
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Copyright (c) 2024 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
+
7
+
8
+ // Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
9
+ export { appTasks } from '@ohos/hvigor-ohos-plugin';
@@ -0,0 +1,12 @@
1
+ {
2
+ "modelVersion": "5.0.0",
3
+ "license": "ISC",
4
+ "name": "rnoh",
5
+ "description": "example description",
6
+ "repository": {},
7
+ "version": "1.0.0",
8
+ "overrides": {
9
+ "@rnoh/react-native-openharmony": "file:./../node_modules/react-native-harmony/harmony/react_native_openharmony.har"
10
+ },
11
+ "dynamicDependencies": {}
12
+ }
@@ -0,0 +1,11 @@
1
+ /*
2
+ * Copyright (c) 2024 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
+
7
+ import {AppRegistry, View, Text} from 'react-native';
8
+ import {name as appName} from './app.json';
9
+ import PushAppDemo from './src/App';
10
+
11
+ AppRegistry.registerComponent(appName, () => PushAppDemo);
@@ -0,0 +1,11 @@
1
+ /*
2
+ * Copyright (c) 2024 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
+
7
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
8
+ module.exports = {
9
+ preset: 'ts-jest',
10
+ testEnvironment: 'node',
11
+ };
@@ -0,0 +1,30 @@
1
+ /*
2
+ * Copyright (c) 2024 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
+
7
+ const {mergeConfig, getDefaultConfig} = require('@react-native/metro-config');
8
+ const {createHarmonyMetroConfig} = require('react-native-harmony/metro.config');
9
+
10
+ /**
11
+ * @type {import("metro-config").ConfigT}
12
+ */
13
+ const config = {
14
+ transformer: {
15
+ getTransformOptions: async () => ({
16
+ transform: {
17
+ experimentalImportSupport: false,
18
+ inlineRequires: true,
19
+ },
20
+ }),
21
+ },
22
+ };
23
+
24
+ module.exports = mergeConfig(
25
+ getDefaultConfig(__dirname),
26
+ createHarmonyMetroConfig({
27
+ reactNativeHarmonyPackageName: 'react-native-harmony',
28
+ }),
29
+ config,
30
+ );
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "react-native-harmony-tester",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "i": "cd ../ && npm i && npm run pack && cd ./example && npm i",
7
+ "reStart": "npm run install:pkg && npm run codegen && hdc rport tcp:8081 tcp:8081 && react-native start",
8
+ "start": "hdc rport tcp:8081 tcp:8081 && react-native start",
9
+ "codegen": "react-native codegen-harmony --rnoh-module-path ./harmony/entry/oh_modules/@rnoh/react-native-openharmony",
10
+ "pack:pkg": "cd ../ && npm pack && cd ./example",
11
+ "install:pkg": "npm uninstall @react-native-ohos/react-native-map-clustering && npm run pack:pkg && npm i @react-native-ohos/react-native-map-clustering@file:../react-native-ohos-react-native-map-clustering-3.4.1-rc.1.tgz",
12
+ "dev": "npm run codegen && react-native bundle-harmony --dev --minify=false",
13
+ "prod": "npm run codegen && react-native bundle-harmony --dev=false --minify=true",
14
+ "postinstall": "node ./scripts/create-build-profile",
15
+ "fast:pkg": "cd ../ && npm i --legacy-peer-deps && npm pack && cd ./example && npm i && npm run dev"
16
+ },
17
+ "dependencies": {
18
+ "@gorhom/portal": "^1.0.14",
19
+ "@react-native-ohos/react-native-map-clustering": "file:../react-native-ohos-react-native-map-clustering-3.4.1-rc.1.tgz",
20
+ "@react-native-ohos/react-native-maps": "file:../packages/react-native-ohos-react-native-maps-1.24.3.tgz",
21
+ "react": "18.3.1",
22
+ "react-native": "0.77.1",
23
+ "react-native-harmony": "file:../packages/rnoh-react-native-harmony-0.77.10.tgz",
24
+ "react-native-reanimated": "^3.6.0"
25
+ },
26
+ "devDependencies": {
27
+ "@babel/core": "^7.25.2",
28
+ "@babel/preset-env": "^7.25.3",
29
+ "@babel/runtime": "^7.25.0",
30
+ "@react-native-community/cli": "15.0.1",
31
+ "@react-native-community/cli-platform-android": "15.0.1",
32
+ "@react-native-community/cli-platform-ios": "15.0.1",
33
+ "@react-native-community/eslint-config": "^3.2.0",
34
+ "@react-native/babel-preset": "0.77.1",
35
+ "@react-native/eslint-config": "0.77.1",
36
+ "@react-native/metro-config": "^0.77.1",
37
+ "@react-native/typescript-config": "0.77.1",
38
+ "@rnoh/react-native-harmony-cli": "file:../packages/rnoh-react-native-harmony-cli-0.77.10.tgz",
39
+ "@tsconfig/react-native": "^3.0.0",
40
+ "@types/d3-scale-chromatic": "^3.0.0",
41
+ "@types/jest": "^29.5.13",
42
+ "@types/react": "^18.2.6",
43
+ "@types/react-test-renderer": "^18.0.0",
44
+ "babel-jest": "^29.6.3",
45
+ "eslint": "^8.19.0",
46
+ "jest": "^29.7.0",
47
+ "metro-react-native-babel-preset": "0.76.8",
48
+ "prettier": "2.8.8",
49
+ "react-test-renderer": "18.3.1",
50
+ "typescript": "5.5.4"
51
+ },
52
+ "overrides": {
53
+ "@react-native-community/cli": "15.0.1"
54
+ },
55
+ "resolutions": {
56
+ "@react-native-community/cli": "15.0.1"
57
+ },
58
+ "engines": {
59
+ "node": ">=18"
60
+ }
61
+ }