已合并
chore: rename module files to .ets and update version 1.1.2-beta.2 #52
hisakoTT创建于 24 天前
chore: rename module files to .ets and update version 1.1.2-beta.2 #52
已合并
共 15 个文件变更+92-15
| @@ -9,7 +9,7 @@ | |||
| 9 | }, | 9 | }, |
| 10 | "name": 'default', | 10 | "name": 'default', |
| 11 | "signingConfig": 'default', | 11 | "signingConfig": 'default', |
| 12 | - "compatibleSdkVersion": '5.0.0(12)', | 12 | + "compatibleSdkVersion": '5.0.5(17)', |
| 13 | "runtimeOS": 'HarmonyOS' | 13 | "runtimeOS": 'HarmonyOS' |
| 14 | }, | 14 | }, |
| 15 | ], | 15 | ], |
| @@ -36,5 +36,9 @@ | |||
| 36 | }, | 36 | }, |
| 37 | ], | 37 | ], |
| 38 | }, | 38 | }, |
| 39 | + { | ||
| 40 | + "name": 'baidu_map', | ||
| 41 | + "srcPath": '../../harmony/baidu_map' | ||
| 42 | + } | ||
| 39 | ], | 43 | ], |
| 40 | } | 44 | } |
| @@ -6,5 +6,6 @@ | |||
| 6 | "version": "1.0.0", | 6 | "version": "1.0.0", |
| 7 | "dependencies": { | 7 | "dependencies": { |
| 8 | "@rnoh/react-native-openharmony": "0.72.90", | 8 | "@rnoh/react-native-openharmony": "0.72.90", |
| 9 | + "@react-native-ohos/react-native-baidu-map": "file:../../../harmony/baidu_map" | ||
| 9 | } | 10 | } |
| 10 | } | 11 | } |
| @@ -17,6 +17,7 @@ add_compile_definitions(WITH_HITRACE_SYSTRACE) | |||
| 17 | include("${CMAKE_CURRENT_SOURCE_DIR}/autolinking.cmake") | 17 | include("${CMAKE_CURRENT_SOURCE_DIR}/autolinking.cmake") |
| 18 | 18 | ||
| 19 | add_subdirectory("${RNOH_CPP_DIR}" ./rn) | 19 | add_subdirectory("${RNOH_CPP_DIR}" ./rn) |
| 20 | +add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-baidu-map/src/main/cpp" ./baidu-map) | ||
| 20 | 21 | ||
| 21 | # RNOH_BEGIN: manual_package_linking_1 | 22 | # RNOH_BEGIN: manual_package_linking_1 |
| 22 | 23 | ||
| @@ -31,6 +32,7 @@ add_library(rnoh_app SHARED | |||
| 31 | ) | 32 | ) |
| 32 | autolink_libraries(rnoh_app) | 33 | autolink_libraries(rnoh_app) |
| 33 | target_link_libraries(rnoh_app PUBLIC rnoh) | 34 | target_link_libraries(rnoh_app PUBLIC rnoh) |
| 35 | +target_link_libraries(rnoh_app PUBLIC rnoh_baidu_map) | ||
| 34 | 36 | ||
| 35 | # RNOH_BEGIN: manual_package_linking_2 | 37 | # RNOH_BEGIN: manual_package_linking_2 |
| 36 | 38 | ||
| @@ -1,6 +1,7 @@ | |||
| 1 | #include "RNOH/PackageProvider.h" | 1 | #include "RNOH/PackageProvider.h" |
| 2 | #include "generated/RNOHGeneratedPackage.h" | 2 | #include "generated/RNOHGeneratedPackage.h" |
| 3 | #include "RNOHPackagesFactory.h" | 3 | #include "RNOHPackagesFactory.h" |
| 4 | +#include "BaiduMapPackage.h" | ||
| 4 | 5 | ||
| 5 | using namespace rnoh; | 6 | using namespace rnoh; |
| 6 | 7 | ||
| @@ -8,6 +9,7 @@ std::vector<std::shared_ptr<Package>> PackageProvider::getPackages( | |||
| 8 | Package::Context ctx) { | 9 | Package::Context ctx) { |
| 9 | const std::vector<std::shared_ptr<Package>> ManualLinkingPackage = { | 10 | const std::vector<std::shared_ptr<Package>> ManualLinkingPackage = { |
| 10 | std::make_shared<RNOHGeneratedPackage>(ctx), | 11 | std::make_shared<RNOHGeneratedPackage>(ctx), |
| 12 | + std::make_shared<BaiduMapPackage>(ctx) | ||
| 11 | }; | 13 | }; |
| 12 | 14 | ||
| 13 | auto packages = createRNOHPackages(ctx); // autolinking | 15 | auto packages = createRNOHPackages(ctx); // autolinking |
| @@ -24,10 +24,11 @@ | |||
| 24 | 24 | ||
| 25 | import type {RNPackageContext, RNPackage} from '@rnoh/react-native-openharmony/ts'; | 25 | import type {RNPackageContext, RNPackage} from '@rnoh/react-native-openharmony/ts'; |
| 26 | import { createRNOHPackages as createRNOHPackagesAutolinking } from './RNOHPackagesFactory' | 26 | import { createRNOHPackages as createRNOHPackagesAutolinking } from './RNOHPackagesFactory' |
| 27 | - | 27 | +import { BaiduMapPackage } from '@react-native-ohos/react-native-baidu-map/ts'; |
| 28 | 28 | ||
| 29 | export function createRNPackages(ctx: RNPackageContext): RNPackage[] { | 29 | export function createRNPackages(ctx: RNPackageContext): RNPackage[] { |
| 30 | return [ | 30 | return [ |
| 31 | - ...createRNOHPackagesAutolinking(ctx) | 31 | + ...createRNOHPackagesAutolinking(ctx), |
| 32 | + new BaiduMapPackage(ctx) | ||
| 32 | ]; | 33 | ]; |
| 33 | } | 34 | } |
| @@ -12,15 +12,69 @@ import { | |||
| 12 | } from '@rnoh/react-native-openharmony'; | 12 | } from '@rnoh/react-native-openharmony'; |
| 13 | import font from '@ohos.font'; | 13 | import font from '@ohos.font'; |
| 14 | import { createRNPackages } from '../RNPackagesFactory'; | 14 | import { createRNPackages } from '../RNPackagesFactory'; |
| 15 | - | 15 | +import { |
| 16 | + BAIDU_MAP_OVERLAY_CIRCLE_TYPE, | ||
| 17 | + BAIDU_MAP_OVERLAY_MARKER_TYPE, | ||
| 18 | + BAIDU_MAP_OVERLAY_POLYGON_TYPE, | ||
| 19 | + BAIDU_MAP_OVERLAY_POLYLINE_TYPE, | ||
| 20 | + BAIDU_MAP_OVERLAY_TEXT_TYPE, | ||
| 21 | + BAIDU_MAP_VIEW_TYPE, | ||
| 22 | + BaiduMapOverlayCircle, | ||
| 23 | + BaiduMapOverlayPolygon, | ||
| 24 | + BaiduMapOverlayPolyline, | ||
| 25 | + BaiduMapOverlayText, | ||
| 26 | + BaiduMapOverlayMarker, | ||
| 27 | + BaiduMapView | ||
| 28 | +} from '@react-native-ohos/react-native-baidu-map'; | ||
| 16 | 29 | ||
| 17 | const arkTsComponentNames: string[] = [ | 30 | const arkTsComponentNames: string[] = [ |
| 18 | - | 31 | + BAIDU_MAP_VIEW_TYPE, |
| 32 | + BAIDU_MAP_OVERLAY_CIRCLE_TYPE, | ||
| 33 | + BAIDU_MAP_OVERLAY_MARKER_TYPE, | ||
| 34 | + BAIDU_MAP_OVERLAY_POLYGON_TYPE, | ||
| 35 | + BAIDU_MAP_OVERLAY_POLYLINE_TYPE, | ||
| 36 | + BAIDU_MAP_OVERLAY_TEXT_TYPE | ||
| 19 | ]; | 37 | ]; |
| 20 | @Builder | 38 | @Builder |
| 21 | export function buildCustomRNComponent(ctx: ComponentBuilderContext) { | 39 | export function buildCustomRNComponent(ctx: ComponentBuilderContext) { |
| 22 | // There seems to be a problem with the placement of ArkTS components in mixed mode. Nested Stack temporarily avoided. | 40 | // There seems to be a problem with the placement of ArkTS components in mixed mode. Nested Stack temporarily avoided. |
| 23 | Stack(){ | 41 | Stack(){ |
| 42 | + if (ctx.componentName === BAIDU_MAP_VIEW_TYPE) { | ||
| 43 | + BaiduMapView({ | ||
| 44 | + ctx: ctx.rnComponentContext, | ||
| 45 | + tag: ctx.tag | ||
| 46 | + }) | ||
| 47 | + } | ||
| 48 | + if (ctx.componentName === BAIDU_MAP_OVERLAY_CIRCLE_TYPE) { | ||
| 49 | + BaiduMapOverlayCircle({ | ||
| 50 | + ctx: ctx.rnComponentContext, | ||
| 51 | + tag: ctx.tag | ||
| 52 | + }) | ||
| 53 | + } | ||
| 54 | + if (ctx.componentName === BAIDU_MAP_OVERLAY_MARKER_TYPE) { | ||
| 55 | + BaiduMapOverlayMarker({ | ||
| 56 | + ctx: ctx.rnComponentContext, | ||
| 57 | + tag: ctx.tag | ||
| 58 | + }) | ||
| 59 | + } | ||
| 60 | + if (ctx.componentName === BAIDU_MAP_OVERLAY_POLYGON_TYPE) { | ||
| 61 | + BaiduMapOverlayPolygon({ | ||
| 62 | + ctx: ctx.rnComponentContext, | ||
| 63 | + tag: ctx.tag | ||
| 64 | + }) | ||
| 65 | + } | ||
| 66 | + if (ctx.componentName === BAIDU_MAP_OVERLAY_POLYLINE_TYPE) { | ||
| 67 | + BaiduMapOverlayPolyline({ | ||
| 68 | + ctx: ctx.rnComponentContext, | ||
| 69 | + tag: ctx.tag | ||
| 70 | + }) | ||
| 71 | + } | ||
| 72 | + if (ctx.componentName === BAIDU_MAP_OVERLAY_TEXT_TYPE) { | ||
| 73 | + BaiduMapOverlayText({ | ||
| 74 | + ctx: ctx.rnComponentContext, | ||
| 75 | + tag: ctx.tag | ||
| 76 | + }) | ||
| 77 | + } | ||
| 24 | } | 78 | } |
| 25 | .position({x:0, y: 0}) | 79 | .position({x:0, y: 0}) |
| 26 | 80 | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | import { harTasks } from '@ohos/hvigor-ohos-plugin'; | 1 | import { harTasks } from '@ohos/hvigor-ohos-plugin'; |
| 2 | 2 | ||
| 3 | export default { | 3 | export default { |
| 4 | - system: harTasks; /* Built-in plugin of Hvigor. It cannot be modified. */ | 4 | + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ |
| 5 | - plugins: []; /* Custom plugin to extend the functionality of Hvigor. */ | 5 | + plugins: [] /* Custom plugin to extend the functionality of Hvigor. */ |
| 6 | } | 6 | } |
| @@ -23,7 +23,7 @@ | |||
| 23 | */ | 23 | */ |
| 24 | 24 | ||
| 25 | import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts'; | 25 | import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts'; |
| 26 | -import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts'; | 26 | +import { RNOHPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony'; |
| 27 | import { BaiduMapTurboModule } from './BaiduMapTurboModule'; | 27 | import { BaiduMapTurboModule } from './BaiduMapTurboModule'; |
| 28 | 28 | ||
| 29 | class BaiduMapTurboModulesFactory extends TurboModulesFactory { | 29 | class BaiduMapTurboModulesFactory extends TurboModulesFactory { |
| @@ -39,7 +39,7 @@ class BaiduMapTurboModulesFactory extends TurboModulesFactory { | |||
| 39 | } | 39 | } |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | -export class BaiduMapPackage extends RNPackage { | 42 | +export class BaiduMapPackage extends RNOHPackage { |
| 43 | createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory { | 43 | createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory { |
| 44 | return new BaiduMapTurboModulesFactory(ctx); | 44 | return new BaiduMapTurboModulesFactory(ctx); |
| 45 | } | 45 | } |