Expand description
§expo-modules-rs
Rust SDK for writing Expo native modules that integrate directly with the JavaScript Interface (JSI) runtime.
This crate provides:
- The
ExpoModuletrait andModuleBuilderfor defining modules JsValuetypes and conversion traits (FromJsValue,IntoJsValue)- The cxx bridge to the JSI C++ layer
- The
#[expo_module]and#[derive(ExpoRecord)]proc macros
§Architecture
+---------------+ +----------------+ +----------------+
| JavaScript |---->| JSI (C++) |---->| Rust Module |
| (Hermes) |<----| jsi_shim.cpp |<----| (your crate) |
+---------------+ +----------------+ +----------------+
| | |
JS calls cxx bridge ExpoModule
module.fn() FfiValue trait impl§Quick Start
ⓘ
use expo_modules_rs::prelude::*;
struct MathModule;
#[expo_module("RustMath")]
impl MathModule {
#[constant]
const PI: f64 = std::f64::consts::PI;
fn add(a: f64, b: f64) -> f64 {
a + b
}
}Modules§
Functions§
- install_
modules ⚠ - C entry point called from the native side (Android JNI or iOS ObjC++) to initialize Rust modules on the JSI runtime.