Nitro Modules are fast, type-safe native modules for React Native with statically compiled bindings to JSI. They consist of two parts:
- react-native-nitro-modules: The core C++ library powering all nitro modules
- nitrogen: An optional code-generator for nitro module library authors
Declaration (TypeScript):
export interface Math extends HybridObject<{ ios: 'c++' }> {
add(a: number, b: number): number
}Implementation (C++, Swift or Kotlin):
class HybridMath: public HybridMathSpec {
public:
HybridMath(): HybridObject(TAG) {}
double add(double a, double b) override {
return a + b;
}
}Usage (TypeScript):
import { NitroModules } from 'react-native-nitro-modules'
const math = NitroModules.createHybridObject<Math>('Math')
const result = math.add(5, 3)Install react-native-nitro-modules from npm:
npm i react-native-nitro-modules
cd ios && pod install- Nitro docs 馃摎
- Community Discord 馃挰
- Nitro Module Builder AI GPT 馃
- How to build a Nitro Module YouTube Tutorial
鈻讹笍 - nitrogen/README.md
- react-native-nitro-modules/README.md
- react-native-nitro-test example module
TestObject.nitro.tsexample playground
Cross-platform native modules can be built with C++. Any custom C++ types can be used and bridged to JS with minimal overhead.
JS <-> C++ type converters are statically generated ahead of time - no more dynamic lookups or runtime parser errors! 馃コ
iOS native modules and view components can be written either in pure C++, or pure Swift. Thanks to Swift 5.9, Swift Nitro Modules bridge directly to C++ instead of going through Objective-C message sends. Woohoo, no more Objective-C, and zero overhead C++ -> Swift calls! 馃コ
Android native modules and view components can be written either in pure C++, or pure Kotlin/Java. Thanks to fbjni, even complex types can be effortlessly bridged to Kotlin/Java with minimal overhead! 馃敟
Nitro is built with 鉂わ笍 by Margelo. We build fast and beautiful apps. Contact us at margelo.com for consultancy services.
Read CONTRIBUTING.md for the contribution flow (PR expectations, the required test-per-fix rule, and the nitrogen workflow). For environment setup and reproduction walkthroughs, see the contributing guide on the docs site.
MIT