2.0 Error Migration
React Native Nitro Geolocation 2.0 replaces numeric error codes in the Modern
API with readable string discriminants. This is a Modern API change only. The
/compat entry point keeps the W3C-style numeric 1, 2, and 3 contract.
Update comparisons
Keep comparisons against LocationErrorCode instead of copying either the old
number or the new string into application code:
The constants now carry their meaning in logs and serialized data:
Narrow unknown errors
JavaScript can throw any value. Use the exported guard when a catch boundary needs a trusted location code:
Migrate persisted errors
Do not reinterpret an old number as a new string. If an app stores Modern API errors, translate known 1.x values once with the table above, write the 2.x string, and discard unknown values. The native Android background status store does this migration automatically for errors recorded by this package.
Keep /compat numeric
No change is required for code imported from
react-native-nitro-geolocation/compat:
Keeping the two contracts separate prevents a Modern-only provider error from leaking into the browser-compatible surface.
