For library users
Nitro V1 requires React Native 0.88 or newer with the New Architecture. Install the Nitro alpha package alongside libraries built for V1:
- npm
- yarn
- pnpm
- bun
npm i react-native-nitro-modules@alpha
yarn add react-native-nitro-modules@alpha
pnpm add react-native-nitro-modules@alpha
bun i react-native-nitro-modules@alpha
For iOS, use Xcode with Swift 6.4 or newer. Choose the package manager your app uses:
- CocoaPods
- Swift Package Manager
Add Nitro's helper next to the React Native require in your ios/Podfile:
require Pod::Executable.execute_command('node', [
'-p',
'require.resolve("react-native-nitro-modules/cocoapods.rb", {paths: [process.argv[1]]})',
__dir__,
]).strip
Inside your app target, call use_nitro_modules! after use_native_modules!. Add nitro_post_install(installer) after
react_native_post_install in your existing hook:
target 'MyApp' do
config = use_native_modules!
use_nitro_modules!
use_react_native!(:path => config[:reactNativePath])
post_install do |installer|
react_native_post_install(installer, config[:reactNativePath])
nitro_post_install(installer)
end
end
Keep the other settings in your existing Podfile. Run pod install from ios/, then open the app's .xcworkspace in Xcode. Nitro's helper
adds the C++ and Swift bridge pods required by the runtime and your Nitro libraries. App targets sharing Nitro must use the same
use_frameworks! setting.
Run this from your app directory:
npx react-native spm
To convert a CocoaPods app to SwiftPM, use npx react-native spm add --deintegrate first. The conversion needs CocoaPods to remove its
existing integration. Open the app's .xcodeproj in Xcode after setup.
Keep Nitro and the libraries' generated bindings on matching V1 versions. The minimum requirements describe the supported native toolchains.