@inoxialabs/react-native-nitro-location-geocoder
v0.1.0
Published
React Native Nitro module for reverse geocoding coordinates into country and locality context.
Maintainers
Readme
@inoxialabs/react-native-nitro-location-geocoder
@inoxialabs/react-native-nitro-location-geocoder is a minimal React Native Nitro module for reverse geocoding latitude and longitude coordinates into normalized country and locality data.
Features
- Native reverse geocoding on both platforms.
- Locale-aware lookups through a language tag such as
en,es, ores-PE. - Normalized result shape for country, locality, and administrative subdivisions.
- Promise-based API exposed through
react-native-nitro-modules. - No product-specific logic or backend dependencies.
Installation
npm install @inoxialabs/react-native-nitro-location-geocoder react-native-nitro-modulesPeer dependencies:
reactreact-nativereact-native-nitro-modules
iOS:
cd ios && pod installUsage
import { reverseGeocode } from '@inoxialabs/react-native-nitro-location-geocoder';
const result = await reverseGeocode(4.711, -74.0721, 'es-CO');
console.log(result.countryCode);
console.log(result.country);
console.log(result.locality);API
reverseGeocode(latitude, longitude, locale)
Returns Promise<LocationGeocoderResult>.
LocationGeocoderResult fields:
countryCodecountrylocalityadministrativeAreasubAdministrativeAreasubLocality
Platform behavior
- iOS uses
CLGeocoder. - Android uses
android.location.Geocoder. - Empty fields are returned as empty strings when the platform geocoder does not provide a value.
- The module rejects when the platform geocoder fails or returns no results.
- Common error values include
NO_RESULTS,UNAVAILABLE,GEOCODER_TIMEOUT, or platform geocoder error messages.
Development
Regenerate Nitro bindings after changing the .nitro.ts spec or nitro.json:
npm install
npm run specs
npm testValidate the package contents before publishing:
npm pack --dry-run