Getting started
Audience: package users installing
react-native-nitro-h3for the first time. This page takes you from an empty project to a first cell: install, one call, and the requirements the build has to meet.
Installation
Section titled “Installation”-
Add the package together with Nitro Modules.
Terminal window bun add react-native-nitro-h3 react-native-nitro-modules -
Install the iOS pods.
Terminal window cd ios && pod install -
Rebuild the app so the native module is linked, with
npx react-native run-iosornpx react-native run-android.
-
Add the package together with Nitro Modules.
Terminal window npm install react-native-nitro-h3 react-native-nitro-modules -
Install the iOS pods.
Terminal window cd ios && pod install -
Rebuild the app so the native module is linked, with
npx react-native run-iosornpx react-native run-android.
-
Add the package with the Expo CLI.
Terminal window npx expo install react-native-nitro-h3 react-native-nitro-modules -
Generate the native projects.
Terminal window npx expo prebuildExpo Go cannot load native modules. Use a development build with
npx expo run:iosornpx expo run:android.
First call
Section titled “First call”import { latLngToCell, gridDisk, cellToString,} from 'react-native-nitro-h3'
// H3 cell for San Francisco at resolution 9const cell = latLngToCell(37.7749, -122.4194, 9)
// Get neighboring cellsconst neighbours = gridDisk(cell, 1)
console.log(neighbours.length) // 7console.log(cellToString(cell)) // "89283082803ffff"latLngToCell returns a bigint, and gridDisk returns a BigUint64Array. Both are explained in
Cell indexes and bigint.
Requirements
Section titled “Requirements”| Platform | Requirement |
|---|---|
| React Native | 0.76+ |
| Nitro Modules | 0.37.0 or newer |
| C++ | C++20-compatible toolchain |
| iOS | React Native deployment target |
| Xcode | recent stable release |
| Android | minSdk 24 |
| Android SDK | compileSdk 36 |
| Android NDK | 27.1.12297006 |
| H3 C library | 4.5.0, vendored |
The package requires the New Architecture, the default since React Native 0.76. The iOS and Android build workflows compile the example app against React Native 0.87.0.
Next steps
Section titled “Next steps”- Migrating from h3-js if you are replacing
h3-js. - Typed arrays and batch calls for workloads over many cells.
- API reference for every exported function.