From 45e71c1c659565f405a923a67a2ee66ad9f0ab01 Mon Sep 17 00:00:00 2001 From: Rodrigo Lago Date: Fri, 8 Aug 2025 14:44:14 +0200 Subject: [PATCH 1/3] WIP: replace react-native-webview with native MapView (Android) --- .../MainApplication.kt | 10 + example/ios/Podfile.lock | 50 +-- .../project.pbxproj | 58 +-- example/package.json | 3 +- package.json | 5 +- .../com/situm/plugin/WebViewReactPackage.java | 30 ++ .../situm/plugin/webview/WebViewManager.java | 53 +++ plugin/package.json | 4 +- plugin/src/wayfinding/components/MapView.tsx | 38 +- plugin/src/wayfinding/utils/index.ts | 7 +- plugin/src/webview/WebView.tsx | 8 + yarn.lock | 395 ++---------------- 12 files changed, 204 insertions(+), 457 deletions(-) create mode 100644 plugin/android/src/main/java/com/situm/plugin/WebViewReactPackage.java create mode 100644 plugin/android/src/main/java/com/situm/plugin/webview/WebViewManager.java create mode 100644 plugin/src/webview/WebView.tsx diff --git a/example/android/app/src/main/java/com/situmreactnativeexample/MainApplication.kt b/example/android/app/src/main/java/com/situmreactnativeexample/MainApplication.kt index e284db0..1fd4346 100644 --- a/example/android/app/src/main/java/com/situmreactnativeexample/MainApplication.kt +++ b/example/android/app/src/main/java/com/situmreactnativeexample/MainApplication.kt @@ -11,6 +11,7 @@ import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost import com.facebook.react.defaults.DefaultReactNativeHost import com.facebook.react.soloader.OpenSourceMergedSoMapping import com.facebook.soloader.SoLoader +import com.situm.plugin.WebViewReactPackage class MainApplication : Application(), ReactApplication { @@ -20,6 +21,15 @@ class MainApplication : Application(), ReactApplication { PackageList(this).packages.apply { // Packages that cannot be autolinked yet can be added manually here, for example: // add(MyReactNativePackage()) + + // Desgraciadamente este paso non fun quen de saltalo. Quizais usando a nova arquitectura + // sexa posible, pero polo menos está funcionando sin a dependencia react-native-webview + // e co noso MapView nativo. + // O plugin react-native-webview non require este paso, así que quero pensar que nós tampouco + // o necesitaremos. + // Ademais este caso é moi especial: temos un monorepo e RN non parece comportarse igual cando + // a instalación do paquete é convencional (vía npm). + add(WebViewReactPackage()) } override fun getJSMainModuleName(): String = "index" diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 5bb8709..aca0499 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1333,32 +1333,8 @@ PODS: - React-jsiexecutor - React-RCTFBReactNativeSpec - ReactCommon/turbomodule/core - - react-native-safe-area-context (5.4.0): + - react-native-safe-area-context (5.5.2): - React-Core - - react-native-webview (13.13.5): - - DoubleConversion - - glog - - hermes-engine - - RCT-Folly (= 2024.11.18.00) - - RCTRequired - - RCTTypeSafety - - React-Core - - React-debug - - React-Fabric - - React-featureflags - - React-graphics - - React-hermes - - React-ImageManager - - React-jsi - - React-NativeModulesApple - - React-RCTFabric - - React-renderercss - - React-rendererdebug - - React-utils - - ReactCodegen - - ReactCommon/turbomodule/bridging - - ReactCommon/turbomodule/core - - Yoga - React-NativeModulesApple (0.79.1): - glog - hermes-engine @@ -1681,7 +1657,7 @@ PODS: - React-logger (= 0.79.1) - React-perflogger (= 0.79.1) - React-utils (= 0.79.1) - - ReactNativeSitumPlugin (3.14.10): + - ReactNativeSitumPlugin (3.15.11): - DoubleConversion - glog - hermes-engine @@ -1705,9 +1681,9 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - SitumSDK (= 3.32.1) + - SitumSDK (= 3.34.2) - Yoga - - RNScreens (4.10.0): + - RNScreens (4.13.1): - DoubleConversion - glog - hermes-engine @@ -1732,7 +1708,7 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga - - RNVectorIcons (10.2.0): + - RNVectorIcons (10.3.0): - DoubleConversion - glog - hermes-engine @@ -1756,7 +1732,7 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga - - SitumSDK (3.32.1): + - SitumSDK (3.34.2): - Protobuf (~> 3.18) - SSZipArchive (~> 2.4) - SocketRocket (0.7.1) @@ -1805,7 +1781,6 @@ DEPENDENCIES: - React-Mapbuffer (from `../node_modules/react-native/ReactCommon`) - React-microtasksnativemodule (from `../node_modules/react-native/ReactCommon/react/nativemodule/microtasks`) - react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`) - - react-native-webview (from `../node_modules/react-native-webview`) - React-NativeModulesApple (from `../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`) - React-oscompat (from `../node_modules/react-native/ReactCommon/oscompat`) - React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`) @@ -1929,8 +1904,6 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/react/nativemodule/microtasks" react-native-safe-area-context: :path: "../node_modules/react-native-safe-area-context" - react-native-webview: - :path: "../node_modules/react-native-webview" React-NativeModulesApple: :path: "../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios" React-oscompat: @@ -2042,8 +2015,7 @@ SPEC CHECKSUMS: React-logger: 34debb54489c4c02e5de4cc057a0943e97d2038a React-Mapbuffer: 206115a22168bd42d6ef21acfe5eb5b39589ed53 React-microtasksnativemodule: 32f7f13d65525e981e9a5b28cebad7d10e0ff711 - react-native-safe-area-context: 8870dc3e45c8d241336cd8ee3fa3fc76f3a040ac - react-native-webview: bfc7322cc9f570bc5b5b2251fb38a08da718d00a + react-native-safe-area-context: 63c9a6def15e6f6377e59cea51566148a2774d62 React-NativeModulesApple: 6d750bb9829fdf0f02c56e9a68cbb390e1f5de25 React-oscompat: 74eb4badd12e93899f37a5dbb03d8a638011a292 React-perflogger: 53be4c46645bbccec870dd82a24764aca9bae4c2 @@ -2075,10 +2047,10 @@ SPEC CHECKSUMS: ReactAppDependencyProvider: f3426eaf6dabae0baec543cd7bac588b6f59210c ReactCodegen: 3288d61658273d72fbd348a74b59710b9790615f ReactCommon: 9f975582dc535de1de110bdb46d4553140a77541 - ReactNativeSitumPlugin: c150d16f6904f949705171e55c4a0f1e6934d43d - RNScreens: 4561eef339c3ebe8176b27e01af7ac494780f678 - RNVectorIcons: ae8e1b95f3468a360896c6242d61885efcc64241 - SitumSDK: affae579fc33fe696831872dc536677386deb49f + ReactNativeSitumPlugin: 1369a65c71c435ee5aba79d2cd3b4bd48f1e0bd8 + RNScreens: 57f90e31c206a86570194544248ba1bb58a30fd3 + RNVectorIcons: 494fed91ffaa4ac555af4a2eaa064a0756fd537e + SitumSDK: 31a8c53c5949e7add0bbc182fff70349ec1b027f SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef Yoga: d15f5aa644c466e917569ac43b19cbf17975239a diff --git a/example/ios/SitumReactNativeExample.xcodeproj/project.pbxproj b/example/ios/SitumReactNativeExample.xcodeproj/project.pbxproj index 0810dcf..28d49f2 100644 --- a/example/ios/SitumReactNativeExample.xcodeproj/project.pbxproj +++ b/example/ios/SitumReactNativeExample.xcodeproj/project.pbxproj @@ -8,9 +8,9 @@ /* Begin PBXBuildFile section */ 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; - 697903932B1BA2918B795231 /* libPods-SitumReactNativeExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F4BB38311068296038245A98 /* libPods-SitumReactNativeExample.a */; }; 761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; }; 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; + C284D66C73B976542CDA1727 /* libPods-SitumReactNativeExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B182261EE747E97123D7AA1D /* libPods-SitumReactNativeExample.a */; }; FCB631348B825A779C6022C1 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */; }; /* End PBXBuildFile section */ @@ -19,12 +19,12 @@ 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = SitumReactNativeExample/Images.xcassets; sourceTree = ""; }; 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = SitumReactNativeExample/Info.plist; sourceTree = ""; }; 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = SitumReactNativeExample/PrivacyInfo.xcprivacy; sourceTree = ""; }; + 5CA178648088396EBE0DACF4 /* Pods-SitumReactNativeExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SitumReactNativeExample.release.xcconfig"; path = "Target Support Files/Pods-SitumReactNativeExample/Pods-SitumReactNativeExample.release.xcconfig"; sourceTree = ""; }; 761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = SitumReactNativeExample/AppDelegate.swift; sourceTree = ""; }; 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = SitumReactNativeExample/LaunchScreen.storyboard; sourceTree = ""; }; - C4603C5680D9A9C692BA3430 /* Pods-SitumReactNativeExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SitumReactNativeExample.debug.xcconfig"; path = "Target Support Files/Pods-SitumReactNativeExample/Pods-SitumReactNativeExample.debug.xcconfig"; sourceTree = ""; }; + AE5087B73F4DEA058329754C /* Pods-SitumReactNativeExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SitumReactNativeExample.debug.xcconfig"; path = "Target Support Files/Pods-SitumReactNativeExample/Pods-SitumReactNativeExample.debug.xcconfig"; sourceTree = ""; }; + B182261EE747E97123D7AA1D /* libPods-SitumReactNativeExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SitumReactNativeExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; - F4BB38311068296038245A98 /* libPods-SitumReactNativeExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SitumReactNativeExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - FE804D3F4267D10C89AD0DEF /* Pods-SitumReactNativeExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SitumReactNativeExample.release.xcconfig"; path = "Target Support Files/Pods-SitumReactNativeExample/Pods-SitumReactNativeExample.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -32,7 +32,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 697903932B1BA2918B795231 /* libPods-SitumReactNativeExample.a in Frameworks */, + C284D66C73B976542CDA1727 /* libPods-SitumReactNativeExample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -55,7 +55,7 @@ isa = PBXGroup; children = ( ED297162215061F000B7C4FE /* JavaScriptCore.framework */, - F4BB38311068296038245A98 /* libPods-SitumReactNativeExample.a */, + B182261EE747E97123D7AA1D /* libPods-SitumReactNativeExample.a */, ); name = Frameworks; sourceTree = ""; @@ -92,8 +92,8 @@ BBD78D7AC51CEA395F1C20DB /* Pods */ = { isa = PBXGroup; children = ( - C4603C5680D9A9C692BA3430 /* Pods-SitumReactNativeExample.debug.xcconfig */, - FE804D3F4267D10C89AD0DEF /* Pods-SitumReactNativeExample.release.xcconfig */, + AE5087B73F4DEA058329754C /* Pods-SitumReactNativeExample.debug.xcconfig */, + 5CA178648088396EBE0DACF4 /* Pods-SitumReactNativeExample.release.xcconfig */, ); path = Pods; sourceTree = ""; @@ -105,13 +105,13 @@ isa = PBXNativeTarget; buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "SitumReactNativeExample" */; buildPhases = ( - B28871CEFB7A8B79239CD635 /* [CP] Check Pods Manifest.lock */, + AA0485FC4380094F313ADD3A /* [CP] Check Pods Manifest.lock */, 13B07F871A680F5B00A75B9A /* Sources */, 13B07F8C1A680F5B00A75B9A /* Frameworks */, 13B07F8E1A680F5B00A75B9A /* Resources */, 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, - D96F17E8160FC49E07C0FD73 /* [CP] Embed Pods Frameworks */, - 7E62D2B47A46B1BD0EBFBF7C /* [CP] Copy Pods Resources */, + 5F76BA1953881AE0A1CCEBA6 /* [CP] Embed Pods Frameworks */, + 1663C7BAC2DFF790ACC2A096 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -183,7 +183,7 @@ shellPath = /bin/sh; shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n"; }; - 7E62D2B47A46B1BD0EBFBF7C /* [CP] Copy Pods Resources */ = { + 1663C7BAC2DFF790ACC2A096 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -200,43 +200,43 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SitumReactNativeExample/Pods-SitumReactNativeExample-resources.sh\"\n"; showEnvVarsInLog = 0; }; - B28871CEFB7A8B79239CD635 /* [CP] Check Pods Manifest.lock */ = { + 5F76BA1953881AE0A1CCEBA6 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-SitumReactNativeExample/Pods-SitumReactNativeExample-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-SitumReactNativeExample-checkManifestLockResult.txt", + "${PODS_ROOT}/Target Support Files/Pods-SitumReactNativeExample/Pods-SitumReactNativeExample-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SitumReactNativeExample/Pods-SitumReactNativeExample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - D96F17E8160FC49E07C0FD73 /* [CP] Embed Pods Frameworks */ = { + AA0485FC4380094F313ADD3A /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-SitumReactNativeExample/Pods-SitumReactNativeExample-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Embed Pods Frameworks"; + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-SitumReactNativeExample/Pods-SitumReactNativeExample-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-SitumReactNativeExample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SitumReactNativeExample/Pods-SitumReactNativeExample-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -255,7 +255,7 @@ /* Begin XCBuildConfiguration section */ 13B07F941A680F5B00A75B9A /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = C4603C5680D9A9C692BA3430 /* Pods-SitumReactNativeExample.debug.xcconfig */; + baseConfigurationReference = AE5087B73F4DEA058329754C /* Pods-SitumReactNativeExample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; @@ -284,7 +284,7 @@ }; 13B07F951A680F5B00A75B9A /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FE804D3F4267D10C89AD0DEF /* Pods-SitumReactNativeExample.release.xcconfig */; + baseConfigurationReference = 5CA178648088396EBE0DACF4 /* Pods-SitumReactNativeExample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; diff --git a/example/package.json b/example/package.json index 7681e8e..3353401 100644 --- a/example/package.json +++ b/example/package.json @@ -18,8 +18,7 @@ "react-native-paper": "^5.13.3", "react-native-safe-area-context": "^5.3.0", "react-native-screens": "^4.10.0", - "react-native-vector-icons": "^10.2.0", - "react-native-webview": "^13.13.5" + "react-native-vector-icons": "^10.2.0" }, "devDependencies": { "@babel/core": "^7.25.2", diff --git a/package.json b/package.json index 72b7d88..462d31e 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,10 @@ }, "resolutions": { "@react-native/gradle-plugin": "0.79.1", - "eslint-plugin-prettier": "^5.4.1" + "eslint-plugin-prettier": "^5.4.1", + "hermes-parser": "^0.31.0", + "@react-native/codegen": "^0.80.2", + "@react-native/js-polyfills": "^0.80.2" }, "description": "Situm React Native plugin monorepo.", "private": true, diff --git a/plugin/android/src/main/java/com/situm/plugin/WebViewReactPackage.java b/plugin/android/src/main/java/com/situm/plugin/WebViewReactPackage.java new file mode 100644 index 0000000..f6d2c56 --- /dev/null +++ b/plugin/android/src/main/java/com/situm/plugin/WebViewReactPackage.java @@ -0,0 +1,30 @@ +package com.situm.plugin; + +import androidx.annotation.NonNull; + +import com.facebook.react.ReactPackage; +import com.facebook.react.bridge.NativeModule; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.uimanager.ViewManager; +import com.situm.plugin.webview.WebViewManager; + +import java.util.Collections; +import java.util.List; + +public class WebViewReactPackage implements ReactPackage { + @Override + public List createNativeModules(ReactApplicationContext reactContext) { + return Collections.emptyList(); + } + + + @NonNull + @Override + public List createViewManagers(@NonNull ReactApplicationContext reactApplicationContext) { + return List.of( + new WebViewManager() + ); + } + + +} diff --git a/plugin/android/src/main/java/com/situm/plugin/webview/WebViewManager.java b/plugin/android/src/main/java/com/situm/plugin/webview/WebViewManager.java new file mode 100644 index 0000000..cc2ce7c --- /dev/null +++ b/plugin/android/src/main/java/com/situm/plugin/webview/WebViewManager.java @@ -0,0 +1,53 @@ +package com.situm.plugin.webview; + +import android.util.Log; +import android.widget.FrameLayout; + +import androidx.annotation.NonNull; + +import com.facebook.react.uimanager.SimpleViewManager; +import com.facebook.react.uimanager.ThemedReactContext; + +import es.situm.sdk.error.Error; +import es.situm.sdk.wayfinding.MapView; +import es.situm.sdk.wayfinding.MapViewConfiguration; +import es.situm.sdk.wayfinding.MapViewController; + +public class WebViewManager extends SimpleViewManager { + + public static final String REACT_CLASS = "WebView"; + // TODO: estou metendo un estático, esto si usamos MapViewManager xa non faría falta. + private static FrameLayout view; + + @NonNull + @Override + public String getName() { + return REACT_CLASS; + } + + @NonNull + @Override + public FrameLayout createViewInstance(ThemedReactContext context) { + if (view == null) { + view = new FrameLayout(context); + MapView mapView = new MapView(context, null); + view.addView(mapView); + // TODO: pasar a config dalgún xeito e facer load(). + MapViewConfiguration config = new MapViewConfiguration.Builder() + .setBuildingIdentifier("7033") + .build(); + mapView.load(config, new MapView.MapViewCallback() { + @Override + public void onLoad(@NonNull MapViewController mapViewController) { + Log.d("ATAG", "MapView loaded!"); + } + + @Override + public void onError(@NonNull Error error) { + Log.e("ATAG", "MapView error: " + error.getMessage()); + } + }); + } + return view; + } +} diff --git a/plugin/package.json b/plugin/package.json index bc85f80..62968e4 100644 --- a/plugin/package.json +++ b/plugin/package.json @@ -85,7 +85,6 @@ "prettier": "^3.2.4", "react-native": "^0.72.12", "react-native-builder-bob": "^0.35.0", - "react-native-webview": ">=11.0.0", "react-test-renderer": "18.2.0", "release-it": "^16.1.3", "typedoc": "^0.28.2", @@ -94,8 +93,7 @@ "peerDependencies": { "react": ">=17.0.0", "react-dom": ">=17.0.0", - "react-native": "*", - "react-native-webview": ">=11.0.0" + "react-native": "*" }, "resolutions": { "@types/react": "19.0.0" diff --git a/plugin/src/wayfinding/components/MapView.tsx b/plugin/src/wayfinding/components/MapView.tsx index 152d8d4..e3fa304 100644 --- a/plugin/src/wayfinding/components/MapView.tsx +++ b/plugin/src/wayfinding/components/MapView.tsx @@ -14,11 +14,7 @@ import { StyleSheet, type ViewStyle, } from "react-native"; -import WebView from "react-native-webview"; -import type { - WebViewErrorEvent, - WebViewMessageEvent, -} from "react-native-webview/lib/WebViewTypes"; +import {WebView} from "../../webview/WebView"; import SitumPlugin from "../../sdk"; import useSitum from "../hooks"; import { @@ -159,7 +155,7 @@ const MapView = React.forwardRef( }, ref, ) => { - const webViewRef = useRef(null); + const webViewRef = useRef>(null); const [_onDirectionsRequestInterceptor, setInterceptor] = useState(); @@ -505,7 +501,8 @@ const MapView = React.forwardRef( // eslint-disable-next-line react-hooks/exhaustive-deps }, [mapLoaded]); - const handleRequestFromViewer = (event: WebViewMessageEvent) => { + // TODO: restaurar aquí o que faga falta, seguramente sobrarán cousas. Ou non, vaite saber. + const handleRequestFromViewer = (event: any) => { const eventParsed = JSON.parse(event.nativeEvent.data); switch (eventParsed.type) { case "app.map_is_ready": @@ -599,7 +596,10 @@ const MapView = React.forwardRef( return ( ( ? `&buildingid=${configuration.buildingIdentifier}` : "" }&show=rts`, - }} + }} */ style={StyleSheet.flatten([viewerStyles.webview, style])} - limitsNavigationsToAppBoundDomains={true} - javaScriptEnabled={true} - domStorageEnabled={true} - startInLoadingState={true} - cacheEnabled - onMessage={handleRequestFromViewer} - onShouldStartLoadWithRequest={_onShouldStartLoadWithRequest} - onError={(evt: WebViewErrorEvent) => { + //limitsNavigationsToAppBoundDomains={true} + //javaScriptEnabled={true} + //domStorageEnabled={true} + //startInLoadingState={true} + //cacheEnabled + //onMessage={handleRequestFromViewer} + //onShouldStartLoadWithRequest={_onShouldStartLoadWithRequest} + /* onError={(evt: any) => { if (!onLoadError) return; const { nativeEvent } = evt; // TODO: on render error should probably still try to render an html @@ -633,8 +633,8 @@ const MapView = React.forwardRef( name: ErrorName.ERR_INTERNAL_SERVER_ERROR, description: nativeEvent.description, }); - } - }} + } + }} */ /> ); }, diff --git a/plugin/src/wayfinding/utils/index.ts b/plugin/src/wayfinding/utils/index.ts index c99f76f..dc8c3ca 100644 --- a/plugin/src/wayfinding/utils/index.ts +++ b/plugin/src/wayfinding/utils/index.ts @@ -1,6 +1,7 @@ -import WebView from "react-native-webview"; +import {WebView} from "../../webview/WebView"; -export const sendMessageToViewer = (viewer: WebView | null, message: string) => { +export const sendMessageToViewer = (viewer: any | null, message: string) => { if (!viewer) return; - viewer.injectJavaScript(`window.postMessage(${message})`); + // TODO: engadir método. + // viewer.injectJavaScript(`window.postMessage(${message})`); }; diff --git a/plugin/src/webview/WebView.tsx b/plugin/src/webview/WebView.tsx new file mode 100644 index 0000000..ddc072e --- /dev/null +++ b/plugin/src/webview/WebView.tsx @@ -0,0 +1,8 @@ +import { requireNativeComponent } from 'react-native'; +import type { ViewStyle } from 'react-native'; + +type Props = { + style?: ViewStyle; +}; + +export const WebView = requireNativeComponent('WebView'); \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 0bce464..fe3c061 100644 --- a/yarn.lock +++ b/yarn.lock @@ -43,7 +43,7 @@ __metadata: languageName: node linkType: hard -"@babel/core@npm:^7.11.6, @babel/core@npm:^7.12.3, @babel/core@npm:^7.13.16, @babel/core@npm:^7.14.0, @babel/core@npm:^7.20.0, @babel/core@npm:^7.22.5, @babel/core@npm:^7.23.9, @babel/core@npm:^7.25.2": +"@babel/core@npm:^7.11.6, @babel/core@npm:^7.12.3, @babel/core@npm:^7.14.0, @babel/core@npm:^7.20.0, @babel/core@npm:^7.22.5, @babel/core@npm:^7.23.9, @babel/core@npm:^7.25.2": version: 7.27.4 resolution: "@babel/core@npm:7.27.4" dependencies: @@ -296,7 +296,7 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.13.16, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.0, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.23.9, @babel/parser@npm:^7.25.3, @babel/parser@npm:^7.27.2, @babel/parser@npm:^7.27.4, @babel/parser@npm:^7.27.5": +"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.0, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.23.9, @babel/parser@npm:^7.25.3, @babel/parser@npm:^7.27.2, @babel/parser@npm:^7.27.4, @babel/parser@npm:^7.27.5": version: 7.27.5 resolution: "@babel/parser@npm:7.27.5" dependencies: @@ -380,7 +380,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-proposal-class-properties@npm:^7.0.0, @babel/plugin-proposal-class-properties@npm:^7.13.0, @babel/plugin-proposal-class-properties@npm:^7.18.0": +"@babel/plugin-proposal-class-properties@npm:^7.0.0, @babel/plugin-proposal-class-properties@npm:^7.18.0": version: 7.18.6 resolution: "@babel/plugin-proposal-class-properties@npm:7.18.6" dependencies: @@ -403,7 +403,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-proposal-nullish-coalescing-operator@npm:^7.0.0, @babel/plugin-proposal-nullish-coalescing-operator@npm:^7.13.8, @babel/plugin-proposal-nullish-coalescing-operator@npm:^7.18.0": +"@babel/plugin-proposal-nullish-coalescing-operator@npm:^7.0.0, @babel/plugin-proposal-nullish-coalescing-operator@npm:^7.18.0": version: 7.18.6 resolution: "@babel/plugin-proposal-nullish-coalescing-operator@npm:7.18.6" dependencies: @@ -454,7 +454,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-proposal-optional-chaining@npm:^7.0.0, @babel/plugin-proposal-optional-chaining@npm:^7.13.12, @babel/plugin-proposal-optional-chaining@npm:^7.20.0": +"@babel/plugin-proposal-optional-chaining@npm:^7.0.0, @babel/plugin-proposal-optional-chaining@npm:^7.20.0": version: 7.21.0 resolution: "@babel/plugin-proposal-optional-chaining@npm:7.21.0" dependencies: @@ -1002,7 +1002,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-modules-commonjs@npm:^7.0.0, @babel/plugin-transform-modules-commonjs@npm:^7.13.8, @babel/plugin-transform-modules-commonjs@npm:^7.24.8, @babel/plugin-transform-modules-commonjs@npm:^7.27.1": +"@babel/plugin-transform-modules-commonjs@npm:^7.0.0, @babel/plugin-transform-modules-commonjs@npm:^7.24.8, @babel/plugin-transform-modules-commonjs@npm:^7.27.1": version: 7.27.1 resolution: "@babel/plugin-transform-modules-commonjs@npm:7.27.1" dependencies: @@ -1510,7 +1510,7 @@ __metadata: languageName: node linkType: hard -"@babel/preset-flow@npm:^7.13.13, @babel/preset-flow@npm:^7.24.7": +"@babel/preset-flow@npm:^7.24.7": version: 7.27.1 resolution: "@babel/preset-flow@npm:7.27.1" dependencies: @@ -1552,7 +1552,7 @@ __metadata: languageName: node linkType: hard -"@babel/preset-typescript@npm:^7.13.0, @babel/preset-typescript@npm:^7.24.7, @babel/preset-typescript@npm:^7.27.0": +"@babel/preset-typescript@npm:^7.24.7, @babel/preset-typescript@npm:^7.27.0": version: 7.27.1 resolution: "@babel/preset-typescript@npm:7.27.1" dependencies: @@ -1567,21 +1567,6 @@ __metadata: languageName: node linkType: hard -"@babel/register@npm:^7.13.16": - version: 7.27.1 - resolution: "@babel/register@npm:7.27.1" - dependencies: - clone-deep: "npm:^4.0.1" - find-cache-dir: "npm:^2.0.0" - make-dir: "npm:^2.1.0" - pirates: "npm:^4.0.6" - source-map-support: "npm:^0.5.16" - peerDependencies: - "@babel/core": ^7.0.0-0 - checksum: 497e0c902614dd66cc70b1c611830f9cdf093bf6c321dae872c3dd42a6f28ddf627d835998568a44a6673af9021239f9f2911b67dcc10f8ffd8995d5f21a7fc0 - languageName: node - linkType: hard - "@babel/runtime@npm:^7.0.0, @babel/runtime@npm:^7.22.5, @babel/runtime@npm:^7.25.0": version: 7.27.4 resolution: "@babel/runtime@npm:7.27.4" @@ -3066,50 +3051,18 @@ __metadata: languageName: node linkType: hard -"@react-native/codegen@npm:0.79.1": - version: 0.79.1 - resolution: "@react-native/codegen@npm:0.79.1" - dependencies: - glob: "npm:^7.1.1" - hermes-parser: "npm:0.25.1" - invariant: "npm:^2.2.4" - nullthrows: "npm:^1.1.1" - yargs: "npm:^17.6.2" - peerDependencies: - "@babel/core": "*" - checksum: d27bad680fdcc5d9dd2e0a27df16742feb31a5d029da34841a843793ebace8ee0e85303e383a7cafce50d197920e0e941bdd1ecb1619689da239977cd8f41556 - languageName: node - linkType: hard - -"@react-native/codegen@npm:0.79.2": - version: 0.79.2 - resolution: "@react-native/codegen@npm:0.79.2" +"@react-native/codegen@npm:^0.80.2": + version: 0.80.2 + resolution: "@react-native/codegen@npm:0.80.2" dependencies: glob: "npm:^7.1.1" - hermes-parser: "npm:0.25.1" + hermes-parser: "npm:0.28.1" invariant: "npm:^2.2.4" nullthrows: "npm:^1.1.1" yargs: "npm:^17.6.2" peerDependencies: "@babel/core": "*" - checksum: 1bb9f50f71fdc4cc32a19191715ed1bdd3e5c2c926da523e7850d79701c974c869bd6e3c815339f6a09e112d78c8a0c10ae2da7dfc5b4271775df160ff812ed7 - languageName: node - linkType: hard - -"@react-native/codegen@npm:^0.72.8": - version: 0.72.8 - resolution: "@react-native/codegen@npm:0.72.8" - dependencies: - "@babel/parser": "npm:^7.20.0" - flow-parser: "npm:^0.206.0" - glob: "npm:^7.1.1" - invariant: "npm:^2.2.4" - jscodeshift: "npm:^0.14.0" - mkdirp: "npm:^0.5.1" - nullthrows: "npm:^1.1.1" - peerDependencies: - "@babel/preset-env": ^7.1.6 - checksum: 42f8d30c8481d1dd9b26e3cb63f57af69a3f3acf3bc0c45c6a64ecf72a89c07be96162a7d90449af4475d1a3bfbc3b1e081e925fbdb2a7e10f0cafb44035fad3 + checksum: 17645687b6c17f77b8f59a4c4ef1c6cb61907ddc7ac8768439748fd354026b8346cb198b04454223759ee8a665b2f3826307759f8c49e2d7d0ae25e22d3eabe0 languageName: node linkType: hard @@ -3244,24 +3197,10 @@ __metadata: languageName: node linkType: hard -"@react-native/js-polyfills@npm:0.79.1": - version: 0.79.1 - resolution: "@react-native/js-polyfills@npm:0.79.1" - checksum: db834ac66d0c9163d3a63eebc26835a3002aa0b195f56c80996fcc2365436ce981364e39ab4ab389c543206bc7a1f81762c697c949dbb432125e23cd99815429 - languageName: node - linkType: hard - -"@react-native/js-polyfills@npm:0.79.2": - version: 0.79.2 - resolution: "@react-native/js-polyfills@npm:0.79.2" - checksum: 436d9e69c4c95d2b58803ad1b750750998a46b2fab742fcdbb4df691abe357f09a3ca1e3f2e700faae37eb6112575cf9a9d44458addc6e36150a69fafd943218 - languageName: node - linkType: hard - -"@react-native/js-polyfills@npm:^0.72.1": - version: 0.72.1 - resolution: "@react-native/js-polyfills@npm:0.72.1" - checksum: 0a4c9559130fcaca335673d27f2ac5aa85ad0505a7929ecc271cdb338d2f159a4e63dc98c2e51bc56495d64d44f6f5c586b1a32fbedd55a3249ee6265c0eef9c +"@react-native/js-polyfills@npm:^0.80.2": + version: 0.80.2 + resolution: "@react-native/js-polyfills@npm:0.80.2" + checksum: 444e195b2d3a374ed64d8eb054d09d3547a84678894c5f91209c98fab3a7fb9f21bc11b9c739761af0e06efbbc53d0bf5ca9b0311b3da8530748cba2038d8765 languageName: node linkType: hard @@ -3572,7 +3511,6 @@ __metadata: prettier: "npm:^3.2.4" react-native: "npm:^0.72.12" react-native-builder-bob: "npm:^0.35.0" - react-native-webview: "npm:>=11.0.0" react-test-renderer: "npm:18.2.0" release-it: "npm:^16.1.3" typedoc: "npm:^0.28.2" @@ -3581,7 +3519,6 @@ __metadata: react: ">=17.0.0" react-dom: ">=17.0.0" react-native: "*" - react-native-webview: ">=11.0.0" languageName: unknown linkType: soft @@ -4568,15 +4505,6 @@ __metadata: languageName: node linkType: hard -"ast-types@npm:0.15.2": - version: 0.15.2 - resolution: "ast-types@npm:0.15.2" - dependencies: - tslib: "npm:^2.0.1" - checksum: 81680bd5829cdec33524e9aa3434e23f3919c0c388927068a0ff2e8466f55b0f34eae53e0007b3668742910c289481ab4e1d486a5318f618ae2fc93b5e7e863b - languageName: node - linkType: hard - "ast-types@npm:^0.13.4": version: 0.13.4 resolution: "ast-types@npm:0.13.4" @@ -4632,15 +4560,6 @@ __metadata: languageName: node linkType: hard -"babel-core@npm:^7.0.0-bridge.0": - version: 7.0.0-bridge.0 - resolution: "babel-core@npm:7.0.0-bridge.0" - peerDependencies: - "@babel/core": ^7.0.0-0 - checksum: 2a1cb879019dffb08d17bec36e13c3a6d74c94773f41c1fd8b14de13f149cc34b705b0a1e07b42fcf35917b49d78db6ff0c5c3b00b202a5235013d517b5c6bbb - languageName: node - linkType: hard - "babel-jest@npm:^29.7.0": version: 29.7.0 resolution: "babel-jest@npm:29.7.0" @@ -5373,17 +5292,6 @@ __metadata: languageName: node linkType: hard -"clone-deep@npm:^4.0.1": - version: 4.0.1 - resolution: "clone-deep@npm:4.0.1" - dependencies: - is-plain-object: "npm:^2.0.4" - kind-of: "npm:^6.0.2" - shallow-clone: "npm:^3.0.0" - checksum: 770f912fe4e6f21873c8e8fbb1e99134db3b93da32df271d00589ea4a29dbe83a9808a322c93f3bcaf8584b8b4fa6fc269fc8032efbaa6728e0c9886c74467d2 - languageName: node - linkType: hard - "clone@npm:^1.0.2": version: 1.0.4 resolution: "clone@npm:1.0.4" @@ -5521,13 +5429,6 @@ __metadata: languageName: node linkType: hard -"commondir@npm:^1.0.1": - version: 1.0.1 - resolution: "commondir@npm:1.0.1" - checksum: 4620bc4936a4ef12ce7dfcd272bb23a99f2ad68889a4e4ad766c9f8ad21af982511934d6f7050d4a8bde90011b1c15d56e61a1b4576d9913efbf697a20172d6c - languageName: node - linkType: hard - "compare-func@npm:^2.0.0": version: 2.0.0 resolution: "compare-func@npm:2.0.0" @@ -6890,7 +6791,7 @@ __metadata: languageName: node linkType: hard -"esprima@npm:^4.0.0, esprima@npm:^4.0.1, esprima@npm:~4.0.0": +"esprima@npm:^4.0.0, esprima@npm:^4.0.1": version: 4.0.1 resolution: "esprima@npm:4.0.1" bin: @@ -6992,7 +6893,6 @@ __metadata: react-native-safe-area-context: "npm:^5.3.0" react-native-screens: "npm:^4.10.0" react-native-vector-icons: "npm:^10.2.0" - react-native-webview: "npm:^13.13.5" react-test-renderer: "npm:19.0.0" typescript: "npm:5.0.4" languageName: unknown @@ -7245,17 +7145,6 @@ __metadata: languageName: node linkType: hard -"find-cache-dir@npm:^2.0.0": - version: 2.1.0 - resolution: "find-cache-dir@npm:2.1.0" - dependencies: - commondir: "npm:^1.0.1" - make-dir: "npm:^2.0.0" - pkg-dir: "npm:^3.0.0" - checksum: 60ad475a6da9f257df4e81900f78986ab367d4f65d33cf802c5b91e969c28a8762f098693d7a571b6e4dd4c15166c2da32ae2d18b6766a18e2071079448fdce4 - languageName: node - linkType: hard - "find-up@npm:^3.0.0": version: 3.0.0 resolution: "find-up@npm:3.0.0" @@ -7317,20 +7206,6 @@ __metadata: languageName: node linkType: hard -"flow-parser@npm:0.*": - version: 0.272.2 - resolution: "flow-parser@npm:0.272.2" - checksum: 51010829d6687da41e9849d97eae24f54ad77b8d76ca7a8ca556821c6001ae0db539dc009dcd6c96977061603012a614798bdb7e8012f28176592798c4047984 - languageName: node - linkType: hard - -"flow-parser@npm:^0.206.0": - version: 0.206.0 - resolution: "flow-parser@npm:0.206.0" - checksum: 26ab7c3f0c23953fac977bcd093b4f18b13a705ea57ef5be8591d100f4c55c83225ae27693bdec3ba38b1d591b9b47b2cd8845eac0bce69cced9d3417154f143 - languageName: node - linkType: hard - "for-each@npm:^0.3.3, for-each@npm:^0.3.5": version: 0.3.5 resolution: "for-each@npm:0.3.5" @@ -7786,7 +7661,7 @@ __metadata: languageName: node linkType: hard -"graceful-fs@npm:^4.1.11, graceful-fs@npm:^4.1.3, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.10, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": +"graceful-fs@npm:^4.1.3, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.10, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": version: 4.2.11 resolution: "graceful-fs@npm:4.2.11" checksum: bf152d0ed1dc159239db1ba1f74fdbc40cb02f626770dcd5815c427ce0688c2635a06ed69af364396da4636d0408fcf7d4afdf7881724c3307e46aff30ca49e2 @@ -7871,67 +7746,19 @@ __metadata: languageName: node linkType: hard -"hermes-estree@npm:0.12.0": - version: 0.12.0 - resolution: "hermes-estree@npm:0.12.0" - checksum: 9aa5e41f4abb522e60ac44950590a08643cdcaa8aac0e4f101b08921880e66778b2f83e08d2c15b94bf87a21d7be1d14f584edf3141b50f79ff091069d92e932 +"hermes-estree@npm:0.31.0": + version: 0.31.0 + resolution: "hermes-estree@npm:0.31.0" + checksum: 581792becadda6c6b5b7d54b190e7a7f532fa97e2f373f19a8dd91e81ac5138b95fc7afea42f6254f2d1315952a5b70cfce6fb2e4a5120857a8728a551fce689 languageName: node linkType: hard -"hermes-estree@npm:0.23.1": - version: 0.23.1 - resolution: "hermes-estree@npm:0.23.1" - checksum: b7ad78f53044d53ec1c77e93036c16e34f6f0985c895540876301e4791d4db08da828870977140f5cf1ae34532bbb9d9d013a0a1a4a5a0da05177225648d5295 - languageName: node - linkType: hard - -"hermes-estree@npm:0.25.1": - version: 0.25.1 - resolution: "hermes-estree@npm:0.25.1" - checksum: 7b1eca98b264a25632064cffa5771360d30cf452e77db1e191f9913ee45cf78c292b2dbca707e92fb71b0870abb97e94b506a5ab80abd96ba237fee169b601fe - languageName: node - linkType: hard - -"hermes-estree@npm:0.28.1": - version: 0.28.1 - resolution: "hermes-estree@npm:0.28.1" - checksum: 3195a1aa7035d96b77839e6bfd6832b51830518aaf8dabfca11248b84d6fb6abd27e21c8caa84229954a76b4f8a1e346b65d421a4daecd3053bd2ea08fe6abc9 - languageName: node - linkType: hard - -"hermes-parser@npm:0.12.0": - version: 0.12.0 - resolution: "hermes-parser@npm:0.12.0" +"hermes-parser@npm:^0.31.0": + version: 0.31.0 + resolution: "hermes-parser@npm:0.31.0" dependencies: - hermes-estree: "npm:0.12.0" - checksum: 8a8656954956187d60d0c6db9cd71cb3e722949a698d77537870dd4d821a2d3278fbeaa9034a950aa2bb75a4830cbf6df0bdb7210927724dc477c5cd34f9bddd - languageName: node - linkType: hard - -"hermes-parser@npm:0.23.1": - version: 0.23.1 - resolution: "hermes-parser@npm:0.23.1" - dependencies: - hermes-estree: "npm:0.23.1" - checksum: de88df4f23bd8dc2ffa89c8a317445320af8c7705a2aeeb05c4dd171f037a747982be153a0a237b1c9c7337b79bceaeb5052934cb8a25fe2e2473294a5343334 - languageName: node - linkType: hard - -"hermes-parser@npm:0.25.1": - version: 0.25.1 - resolution: "hermes-parser@npm:0.25.1" - dependencies: - hermes-estree: "npm:0.25.1" - checksum: 805efc05691420f236654349872c70731121791fa54de521c7ee51059eae34f84dd19f22ee846741dcb60372f8fb5335719b96b4ecb010d2aed7d872f2eff9cc - languageName: node - linkType: hard - -"hermes-parser@npm:0.28.1": - version: 0.28.1 - resolution: "hermes-parser@npm:0.28.1" - dependencies: - hermes-estree: "npm:0.28.1" - checksum: cb2aa4d386929825c3bd8184eeb4e3dcf34892c1f850624d09a80aee0674bc2eb135eccaeb7ac33675552130229ee6160025c4e4f351d6a61b503bd8bfdf63f5 + hermes-estree: "npm:0.31.0" + checksum: 5e66d3d7b474cddff5db20b767f80a5da3cb97daeecc867cbd23f375b5f04f35c7e1dc494c7d169f3f299cc49bbe9f0e85cc423f911012181d2078c595ac742a languageName: node linkType: hard @@ -8222,7 +8049,7 @@ __metadata: languageName: node linkType: hard -"invariant@npm:2.2.4, invariant@npm:^2.2.4": +"invariant@npm:^2.2.4": version: 2.2.4 resolution: "invariant@npm:2.2.4" dependencies: @@ -8596,15 +8423,6 @@ __metadata: languageName: node linkType: hard -"is-plain-object@npm:^2.0.4": - version: 2.0.4 - resolution: "is-plain-object@npm:2.0.4" - dependencies: - isobject: "npm:^3.0.1" - checksum: 2a401140cfd86cabe25214956ae2cfee6fbd8186809555cd0e84574f88de7b17abacb2e477a6a658fa54c6083ecbda1e6ae404c7720244cd198903848fca70ca - languageName: node - linkType: hard - "is-plain-object@npm:^5.0.0": version: 5.0.0 resolution: "is-plain-object@npm:5.0.0" @@ -8825,13 +8643,6 @@ __metadata: languageName: node linkType: hard -"isobject@npm:^3.0.1": - version: 3.0.1 - resolution: "isobject@npm:3.0.1" - checksum: db85c4c970ce30693676487cca0e61da2ca34e8d4967c2e1309143ff910c207133a969f9e4ddb2dc6aba670aabce4e0e307146c310350b298e74a31f7d464703 - languageName: node - linkType: hard - "issue-parser@npm:6.0.0": version: 6.0.0 resolution: "issue-parser@npm:6.0.0" @@ -9501,37 +9312,6 @@ __metadata: languageName: node linkType: hard -"jscodeshift@npm:^0.14.0": - version: 0.14.0 - resolution: "jscodeshift@npm:0.14.0" - dependencies: - "@babel/core": "npm:^7.13.16" - "@babel/parser": "npm:^7.13.16" - "@babel/plugin-proposal-class-properties": "npm:^7.13.0" - "@babel/plugin-proposal-nullish-coalescing-operator": "npm:^7.13.8" - "@babel/plugin-proposal-optional-chaining": "npm:^7.13.12" - "@babel/plugin-transform-modules-commonjs": "npm:^7.13.8" - "@babel/preset-flow": "npm:^7.13.13" - "@babel/preset-typescript": "npm:^7.13.0" - "@babel/register": "npm:^7.13.16" - babel-core: "npm:^7.0.0-bridge.0" - chalk: "npm:^4.1.2" - flow-parser: "npm:0.*" - graceful-fs: "npm:^4.2.4" - micromatch: "npm:^4.0.4" - neo-async: "npm:^2.5.0" - node-dir: "npm:^0.1.17" - recast: "npm:^0.21.0" - temp: "npm:^0.8.4" - write-file-atomic: "npm:^2.3.0" - peerDependencies: - "@babel/preset-env": ^7.1.6 - bin: - jscodeshift: bin/jscodeshift.js - checksum: fc355dde2287c026a682e8b38df5d8d1ff5c9ca044dfd558f2b6d17bb28f9257063bd0e47690814612e572804caa5383733c9d8ca8bc18e70bcee43e0458df59 - languageName: node - linkType: hard - "jsesc@npm:^3.0.2": version: 3.1.0 resolution: "jsesc@npm:3.1.0" @@ -9665,7 +9445,7 @@ __metadata: languageName: node linkType: hard -"kind-of@npm:^6.0.2, kind-of@npm:^6.0.3": +"kind-of@npm:^6.0.3": version: 6.0.3 resolution: "kind-of@npm:6.0.3" checksum: 5873d303fb36aad875b7538798867da2ae5c9e328d67194b0162a3659a627d22f742fc9c4ae95cd1704132a24b00cae5041fc00c0f6ef937dc17080dc4dbb962 @@ -9992,16 +9772,6 @@ __metadata: languageName: node linkType: hard -"make-dir@npm:^2.0.0, make-dir@npm:^2.1.0": - version: 2.1.0 - resolution: "make-dir@npm:2.1.0" - dependencies: - pify: "npm:^4.0.1" - semver: "npm:^5.6.0" - checksum: 043548886bfaf1820323c6a2997e6d2fa51ccc2586ac14e6f14634f7458b4db2daf15f8c310e2a0abd3e0cddc64df1890d8fc7263033602c47bb12cbfcf86aab - languageName: node - linkType: hard - "make-dir@npm:^4.0.0": version: 4.0.0 resolution: "make-dir@npm:4.0.0" @@ -11118,7 +10888,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^3.0.2, minimatch@npm:^3.0.4, minimatch@npm:^3.0.5, minimatch@npm:^3.1.1, minimatch@npm:^3.1.2": +"minimatch@npm:^3.0.4, minimatch@npm:^3.0.5, minimatch@npm:^3.1.1, minimatch@npm:^3.1.2": version: 3.1.2 resolution: "minimatch@npm:3.1.2" dependencies: @@ -11349,13 +11119,6 @@ __metadata: languageName: node linkType: hard -"neo-async@npm:^2.5.0": - version: 2.6.2 - resolution: "neo-async@npm:2.6.2" - checksum: 1a7948fea86f2b33ec766bc899c88796a51ba76a4afc9026764aedc6e7cde692a09067031e4a1bf6db4f978ccd99e7f5b6c03fe47ad9865c3d4f99050d67e002 - languageName: node - linkType: hard - "netmask@npm:^2.0.2": version: 2.0.2 resolution: "netmask@npm:2.0.2" @@ -11386,15 +11149,6 @@ __metadata: languageName: node linkType: hard -"node-dir@npm:^0.1.17": - version: 0.1.17 - resolution: "node-dir@npm:0.1.17" - dependencies: - minimatch: "npm:^3.0.2" - checksum: 281fdea12d9c080a7250e5b5afefa3ab39426d40753ec8126a2d1e67f189b8824723abfed74f5d8549c5d78352d8c489fe08d0b067d7684c87c07283d38374a5 - languageName: node - linkType: hard - "node-domexception@npm:^1.0.0": version: 1.0.0 resolution: "node-domexception@npm:1.0.0" @@ -12073,29 +11827,13 @@ __metadata: languageName: node linkType: hard -"pify@npm:^4.0.1": - version: 4.0.1 - resolution: "pify@npm:4.0.1" - checksum: 8b97cbf9dc6d4c1320cc238a2db0fc67547f9dc77011729ff353faf34f1936ea1a4d7f3c63b2f4980b253be77bcc72ea1e9e76ee3fd53cce2aafb6a8854d07ec - languageName: node - linkType: hard - -"pirates@npm:^4.0.4, pirates@npm:^4.0.6": +"pirates@npm:^4.0.4": version: 4.0.7 resolution: "pirates@npm:4.0.7" checksum: 2427f371366081ae42feb58214f04805d6b41d6b84d74480ebcc9e0ddbd7105a139f7c653daeaf83ad8a1a77214cf07f64178e76de048128fec501eab3305a96 languageName: node linkType: hard -"pkg-dir@npm:^3.0.0": - version: 3.0.0 - resolution: "pkg-dir@npm:3.0.0" - dependencies: - find-up: "npm:^3.0.0" - checksum: 70c9476ffefc77552cc6b1880176b71ad70bfac4f367604b2b04efd19337309a4eec985e94823271c7c0e83946fa5aeb18cd360d15d10a5d7533e19344bfa808 - languageName: node - linkType: hard - "pkg-dir@npm:^4.2.0": version: 4.2.0 resolution: "pkg-dir@npm:4.2.0" @@ -12571,19 +12309,6 @@ __metadata: languageName: node linkType: hard -"react-native-webview@npm:>=11.0.0, react-native-webview@npm:^13.13.5": - version: 13.14.1 - resolution: "react-native-webview@npm:13.14.1" - dependencies: - escape-string-regexp: "npm:^4.0.0" - invariant: "npm:2.2.4" - peerDependencies: - react: "*" - react-native: "*" - checksum: 69fdede0963e93e6f4c48c5b3f395223fb11d911e6c7502ba74b1230d2ddb1aa72d9b783b7d6275178146a3ecab83659f0da11076e8542f034cc8539477e9fee - languageName: node - linkType: hard - "react-native@npm:*": version: 0.79.2 resolution: "react-native@npm:0.79.2" @@ -12874,18 +12599,6 @@ __metadata: languageName: node linkType: hard -"recast@npm:^0.21.0": - version: 0.21.5 - resolution: "recast@npm:0.21.5" - dependencies: - ast-types: "npm:0.15.2" - esprima: "npm:~4.0.0" - source-map: "npm:~0.6.1" - tslib: "npm:^2.0.1" - checksum: b41da2bcf7e705511db2f27d17420ace027de8dd167de9f19190d4988a1f80d112f60c095101ac2f145c8657ddde0c5133eb71df20504efaf3fd9d76ad07e15d - languageName: node - linkType: hard - "rechoir@npm:^0.6.2": version: 0.6.2 resolution: "rechoir@npm:0.6.2" @@ -13249,17 +12962,6 @@ __metadata: languageName: node linkType: hard -"rimraf@npm:~2.6.2": - version: 2.6.3 - resolution: "rimraf@npm:2.6.3" - dependencies: - glob: "npm:^7.1.3" - bin: - rimraf: ./bin.js - checksum: 756419f2fa99aa119c46a9fc03e09d84ecf5421a80a72d1944c5088c9e4671e77128527a900a313ed9d3fdbdd37e2ae05486cd7e9116d5812d8c31f2399d7c86 - languageName: node - linkType: hard - "root-workspace-0b6124@workspace:.": version: 0.0.0-use.local resolution: "root-workspace-0b6124@workspace:." @@ -13407,7 +13109,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:2 || 3 || 4 || 5, semver@npm:^5.6.0": +"semver@npm:2 || 3 || 4 || 5": version: 5.7.2 resolution: "semver@npm:5.7.2" bin: @@ -13536,15 +13238,6 @@ __metadata: languageName: node linkType: hard -"shallow-clone@npm:^3.0.0": - version: 3.0.1 - resolution: "shallow-clone@npm:3.0.1" - dependencies: - kind-of: "npm:^6.0.2" - checksum: e066bd540cfec5e1b0f78134853e0d892d1c8945fb9a926a579946052e7cb0c70ca4fc34f875a8083aa7910d751805d36ae64af250a6de6f3d28f9fa7be6c21b - languageName: node - linkType: hard - "shebang-command@npm:^2.0.0": version: 2.0.0 resolution: "shebang-command@npm:2.0.0" @@ -13722,7 +13415,7 @@ __metadata: languageName: node linkType: hard -"source-map-support@npm:^0.5.16, source-map-support@npm:~0.5.20": +"source-map-support@npm:~0.5.20": version: 0.5.21 resolution: "source-map-support@npm:0.5.21" dependencies: @@ -14177,15 +13870,6 @@ __metadata: languageName: node linkType: hard -"temp@npm:^0.8.4": - version: 0.8.4 - resolution: "temp@npm:0.8.4" - dependencies: - rimraf: "npm:~2.6.2" - checksum: 0a7f76b49637415bc391c3f6e69377cc4c38afac95132b4158fa711e77b70b082fe56fd886f9d11ffab9d148df181a105a93c8b618fb72266eeaa5e5ddbfe37f - languageName: node - linkType: hard - "terser@npm:^5.15.0": version: 5.40.0 resolution: "terser@npm:5.40.0" @@ -15107,17 +14791,6 @@ __metadata: languageName: node linkType: hard -"write-file-atomic@npm:^2.3.0": - version: 2.4.3 - resolution: "write-file-atomic@npm:2.4.3" - dependencies: - graceful-fs: "npm:^4.1.11" - imurmurhash: "npm:^0.1.4" - signal-exit: "npm:^3.0.2" - checksum: 15ce863dce07075d0decedd7c9094f4461e46139d28a758c53162f24c0791c16cd2e7a76baa5b47b1a851fbb51e16f2fab739afb156929b22628f3225437135c - languageName: node - linkType: hard - "write-file-atomic@npm:^3.0.3": version: 3.0.3 resolution: "write-file-atomic@npm:3.0.3" From 93cdc8bc692df7e473a0d49286bba02572feb00f Mon Sep 17 00:00:00 2001 From: Rodrigo Lago Date: Mon, 11 Aug 2025 08:50:52 +0200 Subject: [PATCH 2/3] WIP: replace react-native-webview with native SITMapView (iOS) --- example/ios/Podfile.lock | 12 ++++++------ plugin/ios/SITWebViewManager.h | 21 +++++++++++++++++++++ plugin/ios/SITWebViewManager.m | 29 +++++++++++++++++++++++++++++ plugin/react-native.config.js | 11 +++++++++++ 4 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 plugin/ios/SITWebViewManager.h create mode 100644 plugin/ios/SITWebViewManager.m create mode 100644 plugin/react-native.config.js diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index aca0499..547168d 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1333,7 +1333,7 @@ PODS: - React-jsiexecutor - React-RCTFBReactNativeSpec - ReactCommon/turbomodule/core - - react-native-safe-area-context (5.5.2): + - react-native-safe-area-context (5.4.1): - React-Core - React-NativeModulesApple (0.79.1): - glog @@ -1683,7 +1683,7 @@ PODS: - ReactCommon/turbomodule/core - SitumSDK (= 3.34.2) - Yoga - - RNScreens (4.13.1): + - RNScreens (4.11.1): - DoubleConversion - glog - hermes-engine @@ -1708,7 +1708,7 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga - - RNVectorIcons (10.3.0): + - RNVectorIcons (10.2.0): - DoubleConversion - glog - hermes-engine @@ -2015,7 +2015,7 @@ SPEC CHECKSUMS: React-logger: 34debb54489c4c02e5de4cc057a0943e97d2038a React-Mapbuffer: 206115a22168bd42d6ef21acfe5eb5b39589ed53 React-microtasksnativemodule: 32f7f13d65525e981e9a5b28cebad7d10e0ff711 - react-native-safe-area-context: 63c9a6def15e6f6377e59cea51566148a2774d62 + react-native-safe-area-context: 583e6d44b8500e4d4738119118d1fc01d754bfc0 React-NativeModulesApple: 6d750bb9829fdf0f02c56e9a68cbb390e1f5de25 React-oscompat: 74eb4badd12e93899f37a5dbb03d8a638011a292 React-perflogger: 53be4c46645bbccec870dd82a24764aca9bae4c2 @@ -2048,8 +2048,8 @@ SPEC CHECKSUMS: ReactCodegen: 3288d61658273d72fbd348a74b59710b9790615f ReactCommon: 9f975582dc535de1de110bdb46d4553140a77541 ReactNativeSitumPlugin: 1369a65c71c435ee5aba79d2cd3b4bd48f1e0bd8 - RNScreens: 57f90e31c206a86570194544248ba1bb58a30fd3 - RNVectorIcons: 494fed91ffaa4ac555af4a2eaa064a0756fd537e + RNScreens: 3dbce61975990754e4eadd42e9155d327c3445e7 + RNVectorIcons: ae8e1b95f3468a360896c6242d61885efcc64241 SitumSDK: 31a8c53c5949e7add0bbc182fff70349ec1b027f SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef diff --git a/plugin/ios/SITWebViewManager.h b/plugin/ios/SITWebViewManager.h new file mode 100644 index 0000000..7c6d558 --- /dev/null +++ b/plugin/ios/SITWebViewManager.h @@ -0,0 +1,21 @@ +// +// SITWebViewManager.h +// ReactNativeSitumPlugin +// +// Created by Rodrigo Lago on 11/8/25. +// + +#import +#import +#import + + +NS_ASSUME_NONNULL_BEGIN + +@interface SITWebViewManager : RCTViewManager { + SITMapView *_view; +} + +@end + +NS_ASSUME_NONNULL_END diff --git a/plugin/ios/SITWebViewManager.m b/plugin/ios/SITWebViewManager.m new file mode 100644 index 0000000..6f862f0 --- /dev/null +++ b/plugin/ios/SITWebViewManager.m @@ -0,0 +1,29 @@ +// +// SITWebViewManager.m +// ReactNativeSitumPlugin +// +// Created by Rodrigo Lago on 11/8/25. +// + +#import "SITWebViewManager.h" + +@implementation SITWebViewManager + +RCT_EXPORT_MODULE(WebView) + +- (UIView *)view +{ + _view = [[SITMapView alloc] init]; + // TODO: usar arguments, SITMapViewConfiguration#fromMap(). + SITMapViewConfiguration *config = [[SITMapViewConfiguration alloc] initWithBuildingIdentifier:@"7033" profile:@""]; + [_view loadWithConfiguration:config withCompletion:^(id _Nonnull mapViewController, NSError * _Nullable error) { + if (error) { + NSLog(@"Error loading map: %@", error.localizedDescription); + } else { + NSLog(@"Map loaded properly"); + } + }]; + return _view; +} + +@end diff --git a/plugin/react-native.config.js b/plugin/react-native.config.js new file mode 100644 index 0000000..c4428c7 --- /dev/null +++ b/plugin/react-native.config.js @@ -0,0 +1,11 @@ +module.exports = { + dependencies: { + '@situm/react-native': { + platforms: { + android: { + packageInstance: 'new WebViewReactPackage()', + }, + }, + }, + }, +}; \ No newline at end of file From ec0d3afc2ea3232b2df9b1642895ad7d387381a6 Mon Sep 17 00:00:00 2001 From: Rodrigo Lago Date: Mon, 11 Aug 2025 08:59:39 +0200 Subject: [PATCH 3/3] WIP: add reference to autolinking docs --- .../src/main/java/com/situmreactnativeexample/MainApplication.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/example/android/app/src/main/java/com/situmreactnativeexample/MainApplication.kt b/example/android/app/src/main/java/com/situmreactnativeexample/MainApplication.kt index 1fd4346..2de6003 100644 --- a/example/android/app/src/main/java/com/situmreactnativeexample/MainApplication.kt +++ b/example/android/app/src/main/java/com/situmreactnativeexample/MainApplication.kt @@ -29,6 +29,7 @@ class MainApplication : Application(), ReactApplication { // o necesitaremos. // Ademais este caso é moi especial: temos un monorepo e RN non parece comportarse igual cando // a instalación do paquete é convencional (vía npm). + // TODO: https://github.com/react-native-community/cli/blob/main/docs/autolinking.md add(WebViewReactPackage()) }