Jsi

by software-mansion-labse3f00cdb3494No license291 starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated 10 days ago

React Native JSI (JavaScript Interface) — C++ API for interacting with the JS runtime. Use whenever the user asks about or writes C++ code that touches JSI types or patterns: jsi::Runtime, jsi::Value, jsi::Object, jsi::Function, jsi::Array, jsi::ArrayBuffer, jsi::String, jsi::Symbol, jsi::BigInt, jsi::PropNameID, jsi::HostObject, jsi::HostFunction, jsi::NativeState, jsi::WeakObject, jsi::Scope, JSIException, JSINativeException, JSError, HostFunctionType, createFromHostFunction, getHostObject, setNativeState, evaluateJavaScript, queueMicrotask, drainMicrotasks, setRuntimeData, getRuntimeData, ISerialization, rt.global(), jsi.h, jsi-inl.h, JSI binding, C++ native module, calling JS from C++, calling C++ from JS, HostObject destructor, shared_ptr, CallInvoker, invokeAsync, folly::dynamic with JSI, zero-copy ArrayBuffer, TurboModule C++ layer, Nitro Module, jsi::WithRuntimeDecorator, or any question about the boundary between C++ and the JavaScript engine in React Native.

Instructions onlySoftware Development
AI-generated overview

Reference guidance for writing React Native JSI C++ code that bridges native code and the JavaScript engine.

What it does
This skill supplies reference documentation on React Native's JavaScript Interface (JSI), the C++ API for reading and writing JS values, calling JS functions, and exposing C++ objects to JS. It covers core types, casting and serialization, threading and safety, async calling patterns, performance, setup templates, module approaches, C++ memory patterns, and debugging. It directs the agent to load at most one reference file per question, choosing the most specific match.
When to use it
Use it when a user asks about or writes C++ code touching JSI types or patterns, such as jsi::Runtime, jsi::Value, HostObject, HostFunction, or ArrayBuffer. It also fits questions about the C++/JavaScript boundary in React Native, TurboModule or Nitro Module C++ layers, and JSI crashes or pitfalls.
Requirements
No scripts; instructions and reference markdown files only. No packages, credentials, or network access are required beyond the agent reading the bundled reference files.

React Native JSI

The JavaScript Interface (JSI) is a C++ API that lets native code interact directly with the JavaScript engine — reading and writing JS values, calling JS functions, and exposing C++ objects to JS — without going through the old async bridge.

References

Load at most one reference file per question. Prefer the most specific match.

FileLoad when question is about
overview.mdJSI architecture, why rt.global(), sync vs async model, why some methods take Runtime&, event loop absence, queueMicrotask/drainMicrotasks, setRuntimeData/getRuntimeData, evaluateJavaScript caveat, prototype manipulation
core-types.mdJSI type system: Value, PropNameID, HostFunction, HostObject, NativeState, WeakObject, Array, ArrayBuffer, BigInt, Scope — constructors, ownership, lifetimes, GC behavior
casting-and-serialization.mdThe get/as naming convention, getPropertyAsObject/getPropertyAsFunction, string encoding (createFromAscii vs createFromUtf8), zero-copy string access, C++↔JS type mapping, createFromJsonUtf8, folly::dynamic, ISerialization
threading-safety.mdSingle-thread rule, write operations from multiple threads, JSI object destruction order, Value non-copyable + shared_ptr pattern, hot reload / bundle reload pitfalls, WithRuntimeDecorator<AroundLock>
calling-js-and-async.mdInstalling HostFunction bindings, calling JS functions from C++, callWithThis, callAsConstructor (JS Set / Map / Promise), invokeAsync + CallInvoker, Promise resolve/reject patterns, JSIException hierarchy
performance.mdBatching sequential calls, caching PropNameID, zero-copy ArrayBuffer via MutableBuffer, setExternalMemoryPressure, Scope in tight loops, avoiding evaluateJavaScript for function calls
setup-and-templates.mdInstalling a JSI binding in Android (FBJNI, JSIModulePackage) and iOS (ObjC++ .mm), library scaffolding templates, JSI vs TurboModules vs Nitro Modules
module-approaches.mdChoosing between Pure JSI, TurboModules, Nitro Modules, or a pure C++ core with thin adapter — decision tree, trade-offs, boilerplate comparison
cpp-memory-patterns.mdC++ memory for JS developers: unique_ptr, shared_ptr, std::move, lambda captures, RAII, circular ownership, the GC boundary between JS heap and native heap
debugging-and-pitfalls.mdCrash traces, symbolication (c++filt, addr2line, atos, ndk-stack), ASan, common JSI crash patterns, pre-ship checklist

Source and attribution

Source:software-mansion-labs/skillsinskills/react-native-best-practices/references/jsiat commite3f00cd

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal