react-native-nitro-geolocation 1.2.1 β†’ 1.2.2

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 (2) hide show
  1. package/README.md +104 -7
  2. package/package.json +18 -2
package/README.md CHANGED
@@ -2,13 +2,16 @@
2
2
 
3
3
  [![NPM](https://img.shields.io/npm/v/react-native-nitro-geolocation)](https://www.npmjs.com/package/react-native-nitro-geolocation)
4
4
 
5
- **Simple Native Geolocation for React Native** β€” Powered by Nitro Modules with JSI
5
+ **Nitro-powered geolocation for modern React Native apps**
6
6
 
7
- A complete reimplementation of [`@react-native-community/geolocation`](https://github.com/michalchudziak/react-native-geolocation) for the React Native New Architecture, featuring:
7
+ A native iOS/Android geolocation module for React Native 0.75+ and New
8
+ Architecture apps. Start by replacing
9
+ [`@react-native-community/geolocation`](https://github.com/michalchudziak/react-native-geolocation)
10
+ with `/compat`, then move to a typed Modern API when you are ready.
8
11
 
9
12
  - 🎯 **Simple functional API** β€” Direct function calls, no complex abstractions
10
- - ⚑ **JSI-powered performance** β€” Direct native calls without the Bridge
11
- - πŸ” **100% API compatibility** via `/compat` for easy migration
13
+ - ⚑ **JSI-powered performance** β€” Direct native calls without Bridge overhead
14
+ - πŸ” **Compat API** β€” Drop-in compatible with the core native community API
12
15
  - 🧹 **Automatic cleanup** β€” No manual subscription management
13
16
  - πŸ“± **Consistent behavior** across iOS and Android
14
17
  - πŸ› οΈ **DevTools Plugin** β€” Mock locations with interactive map (Rozenite)
@@ -24,6 +27,24 @@ Full documentation available at:
24
27
 
25
28
  ---
26
29
 
30
+ ## When should I use this?
31
+
32
+ | Use case | Recommendation |
33
+ |---|---|
34
+ | Bare React Native 0.75+ app | Use Nitro Geolocation |
35
+ | Migrating from `@react-native-community/geolocation` | Start with `/compat` |
36
+ | New Architecture / Nitro-based app | Recommended |
37
+ | Expo development build or custom native build | Supported with native setup |
38
+ | Expo managed app without native rebuild | Use `expo-location` |
39
+ | Web support required | Use `@react-native-community/geolocation` or `expo-location` for now |
40
+ | Full background tracking / geofencing | Use a dedicated background-location library |
41
+
42
+ Web is not supported in `v1.2.x`. The community package handles web by
43
+ delegating to the browser `navigator.geolocation` API; this package currently
44
+ targets native Nitro bindings. A `/compat` web fallback is planned for `v1.3`.
45
+
46
+ ---
47
+
27
48
  ## 🧭 Introduction
28
49
 
29
50
  React Native Nitro Geolocation provides **two APIs** to fit your needs:
@@ -121,7 +142,8 @@ function LocationTracker() {
121
142
 
122
143
  ### 2. Compat API (Compatibility)
123
144
 
124
- **Drop-in replacement** for `@react-native-community/geolocation`:
145
+ Drop-in compatible with the core native
146
+ `@react-native-community/geolocation` API:
125
147
 
126
148
  ```tsx
127
149
  import Geolocation from "react-native-nitro-geolocation/compat";
@@ -136,6 +158,19 @@ const watchId = Geolocation.watchPosition((position) => console.log(position));
136
158
  Geolocation.clearWatch(watchId);
137
159
  ```
138
160
 
161
+ #### Compat API coverage
162
+
163
+ | Community API | Nitro `/compat` | Notes |
164
+ |---|---:|---|
165
+ | `setRNConfiguration` | Supported | Android `auto` currently maps to the platform provider; set `playServices` explicitly for fused location. |
166
+ | `requestAuthorization` | Supported | iOS authorization follows configured `Info.plist` keys and `authorizationLevel`. |
167
+ | `getCurrentPosition` | Supported | Keeps the legacy callback and error shape. |
168
+ | `watchPosition` | Supported | Returns a numeric watch id. |
169
+ | `clearWatch` | Supported | Clears a watch id from `watchPosition`. |
170
+ | `stopObserving` | Supported | Preserved for legacy cleanup compatibility. |
171
+ | `navigator.geolocation` polyfill | Not supported in `v1.2.x` | Planned for `v1.3`. |
172
+ | Web | Not supported in `v1.2.x` | Planned as a `/compat` browser fallback in `v1.3`. |
173
+
139
174
  ---
140
175
 
141
176
  ## ⚑ Quick Start
@@ -188,7 +223,34 @@ Optional (for background):
188
223
 
189
224
  ---
190
225
 
191
- ### 4. Development Tools (Optional)
226
+ ### 4. Android Reliability
227
+
228
+ - Uses Google Play Services fused location when `locationProvider:
229
+ "playServices"` is set.
230
+ - Keeps `locationProvider: "auto"` on Android's platform `LocationManager` by
231
+ default. Set `playServices` explicitly when you want fused location behavior.
232
+ - Supports native settings resolution through `requestLocationSettings`.
233
+ - Supports approximate/coarse location handling through permissions and
234
+ Android `granularity`.
235
+ - Supports explicit cached reads through `getLastKnownPosition`.
236
+ - Provides structured Modern API errors such as `PLAY_SERVICE_NOT_AVAILABLE`,
237
+ `SETTINGS_NOT_SATISFIED`, and `TIMEOUT`.
238
+
239
+ ---
240
+
241
+ ### 5. Expo Development Builds
242
+
243
+ This package requires native Nitro bindings, so it is not an Expo Go module.
244
+ Use Expo prebuild, a development build, or another custom native build flow,
245
+ then apply the same iOS and Android native permission setup shown above.
246
+
247
+ Managed Expo apps that cannot rebuild native code should use `expo-location`.
248
+ See the [Expo development build guide](https://react-native-nitro-geolocation.pages.dev/guide/expo-development-build)
249
+ for the supported setup path.
250
+
251
+ ---
252
+
253
+ ### 6. Development Tools (Optional)
192
254
 
193
255
  #### DevTools Plugin (Rozenite)
194
256
 
@@ -238,7 +300,7 @@ function App() {
238
300
 
239
301
  ---
240
302
 
241
- ### 5. Usage
303
+ ### 7. Usage
242
304
 
243
305
  #### Modern API (Recommended)
244
306
 
@@ -291,6 +353,10 @@ Geolocation.clearWatch(watchId);
291
353
 
292
354
  ## πŸ”„ Migration from `@react-native-community/geolocation`
293
355
 
356
+ The safest migration is two-step: switch imports to `/compat` first, verify
357
+ the app, then move call sites to the Modern API where it improves ownership,
358
+ permission timing, cache behavior, or Android settings handling.
359
+
294
360
  For Modern API migration, install the Agent Skills-compatible migration
295
361
  playbook from this repository. It is migration assistance for coding agents, not
296
362
  a fully automatic migration. The skill first runs a package-manager-aware
@@ -319,6 +385,35 @@ For a drop-in compatibility migration, change the import to use `/compat`:
319
385
  + import Geolocation from 'react-native-nitro-geolocation/compat';
320
386
  ```
321
387
 
388
+ Then migrate individual call sites to the Modern API:
389
+
390
+ ```diff
391
+ - Geolocation.getCurrentPosition(onSuccess, onError, {
392
+ - enableHighAccuracy: true,
393
+ - timeout: 15000,
394
+ - });
395
+ + const position = await getCurrentPosition({
396
+ + accuracy: { android: "high", ios: "best" },
397
+ + timeout: 15000,
398
+ + });
399
+ ```
400
+
401
+ See the [migration demo](https://react-native-nitro-geolocation.pages.dev/guide/migration-demo)
402
+ for the full community import β†’ `/compat` β†’ Modern API path.
403
+
404
+ ---
405
+
406
+ ## Benchmark scope
407
+
408
+ The benchmark measures cached `getCurrentPosition` reads over 1000 iterations Γ—
409
+ 5 runs on an iPhone 14 Pro with React Native 0.81.4. It measures the
410
+ JS-to-native path for cached locations, not cold GPS acquisition, permission
411
+ dialogs, provider availability, or OS throttling.
412
+
413
+ For cached location reads, Nitro removes Bridge overhead. This does not make GPS
414
+ acquisition itself 22x faster; it makes cached reads and the JS-to-native call
415
+ path cheaper.
416
+
322
417
  ---
323
418
 
324
419
  ## πŸ“– Learn More
@@ -327,6 +422,8 @@ For a drop-in compatibility migration, change the import to use `/compat`:
327
422
  - [Quick Start Guide](https://react-native-nitro-geolocation.pages.dev/guide/quick-start)
328
423
  - [Modern API Reference](https://react-native-nitro-geolocation.pages.dev/guide/modern-api)
329
424
  - [Compat API Reference](https://react-native-nitro-geolocation.pages.dev/guide/compat-api)
425
+ - [Migration Demo](https://react-native-nitro-geolocation.pages.dev/guide/migration-demo)
426
+ - [Expo Development Build Guide](https://react-native-nitro-geolocation.pages.dev/guide/expo-development-build)
330
427
  - [DevTools Plugin Guide](https://react-native-nitro-geolocation.pages.dev/guide/devtools)
331
428
  - [Why Nitro Module?](https://react-native-nitro-geolocation.pages.dev/guide/why-nitro-module)
332
429
  - [Benchmark Results](https://react-native-nitro-geolocation.pages.dev/guide/benchmark)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-nitro-geolocation",
3
- "version": "1.2.1",
4
- "description": "βš‘πŸš€Blazing-fast geolocation for React Native powered by Nitro Modules",
3
+ "version": "1.2.2",
4
+ "description": "Nitro-powered native geolocation for modern React Native apps",
5
5
  "main": "src/index",
6
6
  "source": "src/index",
7
7
  "exports": {
@@ -26,6 +26,22 @@
26
26
  },
27
27
  "author": "jingjing2222",
28
28
  "license": "MIT",
29
+ "keywords": [
30
+ "react-native",
31
+ "geolocation",
32
+ "location",
33
+ "gps",
34
+ "ios",
35
+ "android",
36
+ "nitro",
37
+ "nitro-modules",
38
+ "jsi",
39
+ "new-architecture",
40
+ "fused-location",
41
+ "geocoding",
42
+ "heading",
43
+ "expo-dev-client"
44
+ ],
29
45
  "homepage": "https://react-native-nitro-geolocation.pages.dev",
30
46
  "repository": {
31
47
  "type": "git",