diff --git a/configs/jsactions/rollup.config.mjs b/configs/jsactions/rollup.config.mjs index d8691fac1..6930d6bd7 100644 --- a/configs/jsactions/rollup.config.mjs +++ b/configs/jsactions/rollup.config.mjs @@ -34,6 +34,7 @@ export default async args => { types: ["mendix-client", "react-native"], allowSyntheticDefaultImports: true, compilerOptions: { + jsx: "react-native", newLine: "CRLF" } }); diff --git a/packages/jsActions/nanoflow-actions-native/CHANGELOG.md b/packages/jsActions/nanoflow-actions-native/CHANGELOG.md index 0a18c5fe2..d9f21987f 100644 --- a/packages/jsActions/nanoflow-actions-native/CHANGELOG.md +++ b/packages/jsActions/nanoflow-actions-native/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### Changed + +- Migrated the geolocation actions (`Get current location` and `Get current location with minimum accuracy`) from `@react-native-community/geolocation` to `react-native-nitro-geolocation`. + ## [7.1.0] Nanoflow Commons - 2026-6-5 ### Changed diff --git a/packages/jsActions/nanoflow-actions-native/package.json b/packages/jsActions/nanoflow-actions-native/package.json index aea3b75f4..2e9e1abae 100644 --- a/packages/jsActions/nanoflow-actions-native/package.json +++ b/packages/jsActions/nanoflow-actions-native/package.json @@ -27,9 +27,10 @@ }, "dependencies": { "@react-native-async-storage/async-storage": "2.2.0", - "@react-native-community/geolocation": "3.4.0", "invariant": "^2.2.4", "js-base64": "~3.7.2", + "react-native-nitro-geolocation": "1.4.0", + "react-native-nitro-modules": "0.35.9", "react-native-permissions": "5.5.1", "react-native-geocoder": "0.5.0" }, diff --git a/packages/jsActions/nanoflow-actions-native/src/geolocation/GetCurrentLocation.ts b/packages/jsActions/nanoflow-actions-native/src/geolocation/GetCurrentLocation.ts index b333c81d4..9883dcbc0 100644 --- a/packages/jsActions/nanoflow-actions-native/src/geolocation/GetCurrentLocation.ts +++ b/packages/jsActions/nanoflow-actions-native/src/geolocation/GetCurrentLocation.ts @@ -10,7 +10,7 @@ import Geolocation, { GeolocationError, GeolocationOptions, GeolocationResponse -} from "@react-native-community/geolocation"; +} from "react-native-nitro-geolocation/src/compat"; import type { Platform, NativeModules } from "react-native"; import type { GeoError, GeoPosition, GeoOptions } from "../../typings/Geolocation"; @@ -40,7 +40,7 @@ export async function GetCurrentLocation( // BEGIN USER CODE let reactNativeModule: { NativeModules: typeof NativeModules; Platform: typeof Platform } | undefined; - let geolocationModule: typeof import("@react-native-community/geolocation").default | Geolocation; + let geolocationModule: typeof import("react-native-nitro-geolocation/src/compat").default | Geolocation; if (navigator && navigator.product === "ReactNative") { reactNativeModule = require("react-native"); @@ -49,13 +49,7 @@ export async function GetCurrentLocation( return Promise.reject(new Error("React Native module could not be found")); } - if (reactNativeModule.NativeModules.RNFusedLocation) { - geolocationModule = (await import("@react-native-community/geolocation")).default; - } else if (reactNativeModule.NativeModules.RNCGeolocation) { - geolocationModule = Geolocation; - } else { - return Promise.reject(new Error("Geolocation module could not be found")); - } + geolocationModule = Geolocation; } else if (navigator && navigator.geolocation) { geolocationModule = navigator.geolocation; } else { diff --git a/packages/jsActions/nanoflow-actions-native/src/geolocation/GetCurrentLocationMinimumAccuracy.ts b/packages/jsActions/nanoflow-actions-native/src/geolocation/GetCurrentLocationMinimumAccuracy.ts index 7756b3e1b..ca00752a0 100644 --- a/packages/jsActions/nanoflow-actions-native/src/geolocation/GetCurrentLocationMinimumAccuracy.ts +++ b/packages/jsActions/nanoflow-actions-native/src/geolocation/GetCurrentLocationMinimumAccuracy.ts @@ -10,7 +10,7 @@ import Geolocation, { GeolocationError, GeolocationOptions, GeolocationResponse -} from "@react-native-community/geolocation"; +} from "react-native-nitro-geolocation/src/compat"; import type { Platform, NativeModules } from "react-native"; import type { GeoError, GeoPosition, GeoOptions } from "../../typings/Geolocation"; @@ -44,7 +44,7 @@ export async function GetCurrentLocationMinimumAccuracy( // BEGIN USER CODE let reactNativeModule: { NativeModules: typeof NativeModules; Platform: typeof Platform } | undefined; - let geolocationModule: typeof import("@react-native-community/geolocation").default | Geolocation; + let geolocationModule: typeof import("react-native-nitro-geolocation/src/compat").default | Geolocation; if (navigator && navigator.product === "ReactNative") { reactNativeModule = require("react-native"); @@ -53,13 +53,7 @@ export async function GetCurrentLocationMinimumAccuracy( return Promise.reject(new Error("React Native module could not be found")); } - if (reactNativeModule.NativeModules.RNFusedLocation) { - geolocationModule = (await import("@react-native-community/geolocation")).default; - } else if (reactNativeModule.NativeModules.RNCGeolocation) { - geolocationModule = Geolocation; - } else { - return Promise.reject(new Error("Geolocation module could not be found")); - } + geolocationModule = Geolocation; } else if (navigator && navigator.geolocation) { geolocationModule = navigator.geolocation; } else { diff --git a/packages/jsActions/nanoflow-actions-native/typings/Geolocation.d.ts b/packages/jsActions/nanoflow-actions-native/typings/Geolocation.d.ts index c92f243d4..dab2297eb 100644 --- a/packages/jsActions/nanoflow-actions-native/typings/Geolocation.d.ts +++ b/packages/jsActions/nanoflow-actions-native/typings/Geolocation.d.ts @@ -1,15 +1,17 @@ import type { - AuthorizationLevel, - AuthorizationResult, - GeoError, - GeoPosition, - GeoOptions, + GeolocationError, + GeolocationOptions, + GeolocationResponse, getCurrentPosition, requestAuthorization, watchPosition, clearWatch, stopObserving -} from "@react-native-community/geolocation"; +} from "react-native-nitro-geolocation/src/compat"; + +type GeoError = GeolocationError; +type GeoPosition = GeolocationResponse; +type GeoOptions = GeolocationOptions; type GeolocationServiceStatic = { getCurrentPosition: typeof getCurrentPosition; @@ -19,4 +21,4 @@ type GeolocationServiceStatic = { stopObserving: typeof stopObserving; }; -export type { GeolocationServiceStatic, AuthorizationLevel, AuthorizationResult, GeoError, GeoPosition, GeoOptions }; +export type { GeolocationServiceStatic, GeoError, GeoPosition, GeoOptions }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f9873dfbc..464ee68e5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -209,9 +209,6 @@ importers: '@react-native-async-storage/async-storage': specifier: 2.2.0 version: 2.2.0(react-native@0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3)) - '@react-native-community/geolocation': - specifier: 3.4.0 - version: 3.4.0(react-native@0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3))(react@19.2.3) invariant: specifier: ^2.2.4 version: 2.2.4 @@ -221,6 +218,12 @@ importers: react-native-geocoder: specifier: 0.5.0 version: 0.5.0 + react-native-nitro-geolocation: + specifier: 1.4.0 + version: 1.4.0(react-native-nitro-modules@0.35.9(react-native@0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3))(react@19.2.3))(react-native@0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3))(react@19.2.3) + react-native-nitro-modules: + specifier: 0.35.9 + version: 0.35.9(react-native@0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3))(react@19.2.3) react-native-permissions: specifier: 5.5.1 version: 5.5.1(react-native@0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3))(react@19.2.3) @@ -2099,13 +2102,6 @@ packages: peerDependencies: react-native: 0.84.1 - '@react-native-community/geolocation@3.4.0': - resolution: {integrity: sha512-bzZH89/cwmpkPMKKveoC72C4JH0yF4St5Ceg/ZM9pA1SqX9MlRIrIrrOGZ/+yi++xAvFDiYfihtn9TvXWU9/rA==} - engines: {node: '>=18.0.0'} - peerDependencies: - react: 19.2.3 - react-native: 0.84.1 - '@react-native-community/netinfo@11.5.2': resolution: {integrity: sha512-/g0m65BtX9HU+bPiCH2517bOHpEIUsGrWFXDzi1a5nNKn5KujQgm04WhL7/OSXWKHyrT8VVtUoJA0XKRxueBpQ==} peerDependencies: @@ -6138,6 +6134,19 @@ packages: react: 19.2.3 react-native: 0.84.1 + react-native-nitro-geolocation@1.4.0: + resolution: {integrity: sha512-SOrE6DJ2ApDc2sIIC7xaPVo5hHNh+wTHc76OhqLjNvCxR6KJCH6xH8sfhqXKU15S7sVPMgqsdagCIV7ju63dXA==} + peerDependencies: + react: 19.2.3 + react-native: 0.84.1 + react-native-nitro-modules: '*' + + react-native-nitro-modules@0.35.9: + resolution: {integrity: sha512-yCO6eJ85SPPUo4a4an7H5oj6wPCSIT72fbjr5WZ/20n6zswaJ2gNNpnWtg2We0AZwkAOjSqkOJ0Vjc05p6kGiA==} + peerDependencies: + react: 19.2.3 + react-native: 0.84.1 + react-native-permissions@5.5.1: resolution: {integrity: sha512-nTKFoj47b6EXNqbbg+8VFwBWMpxF1/UTbrNBLpXkWpt005pH4BeFv/NwpcC1iNhToKBrxQD+5kI0z6+kTYoYWA==} peerDependencies: @@ -9006,11 +9015,6 @@ snapshots: dependencies: react-native: 0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3) - '@react-native-community/geolocation@3.4.0(react-native@0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3))(react@19.2.3)': - dependencies: - react: 19.2.3 - react-native: 0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3) - '@react-native-community/netinfo@11.5.2(react-native@0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3))(react@19.2.3)': dependencies: react: 19.2.3 @@ -13972,6 +13976,17 @@ snapshots: react-native: 0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3) react-native-animatable: 1.3.3 + react-native-nitro-geolocation@1.4.0(react-native-nitro-modules@0.35.9(react-native@0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3))(react@19.2.3))(react-native@0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3))(react@19.2.3): + dependencies: + react: 19.2.3 + react-native: 0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3) + react-native-nitro-modules: 0.35.9(react-native@0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3))(react@19.2.3) + + react-native-nitro-modules@0.35.9(react-native@0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3))(react@19.2.3): + dependencies: + react: 19.2.3 + react-native: 0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3) + react-native-permissions@5.5.1(react-native@0.84.1(@babel/core@7.29.0)(@react-native/metro-config@0.85.3(@babel/core@7.29.0))(@types/react@19.2.15)(react@19.2.3))(react@19.2.3): dependencies: react: 19.2.3