react-native-nitro-geolocation 1.2.0 → 1.2.1
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.
package/README.md
CHANGED
|
@@ -291,7 +291,29 @@ Geolocation.clearWatch(watchId);
|
|
|
291
291
|
|
|
292
292
|
## 🔄 Migration from `@react-native-community/geolocation`
|
|
293
293
|
|
|
294
|
-
|
|
294
|
+
For Modern API migration, install the Agent Skills-compatible migration
|
|
295
|
+
playbook from this repository. It is migration assistance for coding agents, not
|
|
296
|
+
a fully automatic migration. The skill first runs a package-manager-aware
|
|
297
|
+
compat bootstrap script that installs the Nitro packages, rewrites legacy import
|
|
298
|
+
sources to `/compat`, and removes `@react-native-community/geolocation`. After
|
|
299
|
+
that safe mechanical step, it guides the agent to refactor compat call sites to
|
|
300
|
+
Modern API best practices using explicit criteria for permission timing, React
|
|
301
|
+
lifecycle ownership, watch cleanup, cache-vs-fresh location reads, accuracy, and
|
|
302
|
+
Android provider/settings handling.
|
|
303
|
+
|
|
304
|
+
With the Vercel Labs `skills` CLI:
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
npx skills add jingjing2222/react-native-nitro-geolocation --skill react-native-nitro-geolocation-modern-migration
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
The skill source is
|
|
311
|
+
[`skills/react-native-nitro-geolocation-modern-migration/SKILL.md`](https://github.com/jingjing2222/react-native-nitro-geolocation/tree/main/skills/react-native-nitro-geolocation-modern-migration).
|
|
312
|
+
The bundled bootstrap script is
|
|
313
|
+
[`skills/react-native-nitro-geolocation-modern-migration/scripts/migrate-to-compat.mjs`](https://github.com/jingjing2222/react-native-nitro-geolocation/tree/main/skills/react-native-nitro-geolocation-modern-migration/scripts/migrate-to-compat.mjs).
|
|
314
|
+
|
|
315
|
+
For a drop-in compatibility migration, change the import to use `/compat`:
|
|
316
|
+
|
|
295
317
|
```diff
|
|
296
318
|
- import Geolocation from '@react-native-community/geolocation';
|
|
297
319
|
+ import Geolocation from 'react-native-nitro-geolocation/compat';
|
|
@@ -747,6 +747,8 @@ class NitroGeolocation(
|
|
|
747
747
|
// MARK: - Helper Functions - Provider Selection
|
|
748
748
|
|
|
749
749
|
private fun requiresPlayServices(): Boolean {
|
|
750
|
+
// TODO: Switch auto/default Android provider selection to prefer
|
|
751
|
+
// Google Play Services when available.
|
|
750
752
|
return configuration?.locationProvider == LocationProvider.PLAYSERVICES
|
|
751
753
|
}
|
|
752
754
|
|
package/package.json
CHANGED
|
@@ -67,7 +67,7 @@ export interface GeolocationConfiguration {
|
|
|
67
67
|
* Android: Location provider
|
|
68
68
|
* - 'playServices': Use Google Play Services (fused location)
|
|
69
69
|
* - 'android_platform': Use Android platform LocationManager
|
|
70
|
-
* - 'auto':
|
|
70
|
+
* - 'auto': Use Android platform LocationManager by default
|
|
71
71
|
*/
|
|
72
72
|
locationProvider?: LocationProvider;
|
|
73
73
|
}
|
package/src/publicTypes.ts
CHANGED
|
@@ -79,6 +79,12 @@ export type GeolocationConfiguration = Omit<
|
|
|
79
79
|
*/
|
|
80
80
|
autoRequestPermission?: boolean;
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Android location provider.
|
|
84
|
+
*
|
|
85
|
+
* `auto` currently uses Android's platform `LocationManager` by default.
|
|
86
|
+
* Set `playServices` explicitly to use Google Play Services fused location.
|
|
87
|
+
*/
|
|
82
88
|
locationProvider?: LocationProvider;
|
|
83
89
|
};
|
|
84
90
|
|
|
@@ -92,5 +98,11 @@ export type CompatGeolocationConfiguration = Omit<
|
|
|
92
98
|
CompatGeolocationConfigurationInternal,
|
|
93
99
|
"locationProvider"
|
|
94
100
|
> & {
|
|
101
|
+
/**
|
|
102
|
+
* Android location provider.
|
|
103
|
+
*
|
|
104
|
+
* `auto` currently uses Android's platform `LocationManager` by default.
|
|
105
|
+
* Set `playServices` explicitly to use Google Play Services fused location.
|
|
106
|
+
*/
|
|
95
107
|
locationProvider?: LocationProvider;
|
|
96
108
|
};
|