Skip to content
react-native-nitro-h3

react-native-nitro-h3

Fast H3 geospatial indexing for React Native, powered by Nitro Modules.

npm versionCILicense: MITVendored H3 v4.5.0

for compactCells on a k=20 disk containing 1,261 cells. iPhone XS, iOS 18.7.9, React Native 0.87.0, Hermes, 20-run median, 2026-09-01. Every result was verified against h3-js 4.5.0 for equivalence.

react-native-nitro-h3 against h3-js, median milliseconds per workload

Native execution

H3 4.5.0 runs as compiled C++ on iOS and Android, called directly through Nitro Modules.

bigint cell indexes

H3’s 64-bit indexes stay numeric. No hexadecimal strings cross the JavaScript boundary, and functions keep the h3-js names, with unit suffixes instead of a unit argument.

Typed-array results

A cell set arrives as one BigUint64Array over the buffer C++ produced, viewed in place instead of copied per element.

Batch calls

latLngsToCells, cellsToLatLngs and cellsToBoundaries process a whole coordinate or cell array in a single native call, the last answering every cell’s boundary as [lat, lng] pairs in one flat buffer.

Async variants

Four async variants move the expensive calls to a background thread and resolve with the same typed arrays.

Optional cell ceiling

configure() sets a ceiling that rejects an unexpectedly large result before allocation. Off by default.

  1. Add the package together with Nitro Modules.

    Terminal window
    bun add react-native-nitro-h3 react-native-nitro-modules
  2. Install the iOS pods.

    Terminal window
    cd ios && pod install
  3. Rebuild the app so the native module is linked, with npx react-native run-ios or npx react-native run-android.

Built on the H3 C library 4.5.0 by Uber, vendored in the package and recorded in third_party/h3/H3_VERSION. Every function is verified against h3-js 4.5.0 for equivalence in CI.

Functions keep the h3-js names, with unit suffixes instead of a unit argument. Cells are bigint, cell sets are a BigUint64Array over native memory, and nothing is parsed on the JavaScript side.

import { gridDisk, latLngToCell } from 'react-native-nitro-h3'
const cell = latLngToCell(37.7749, -122.4194, 9) // 0x89283082803ffffn
const ring = gridDisk(cell, 1) // BigUint64Array of 7 cells

Last updated: