TurboModule substitution is a new feature in react-native-sandbox v0.6.0 that lets host apps transparently swap native modules for sandbox-scoped alternatives. Instead of blocking or fully allowing native capabilities, hosts can provide sandboxed implementations that scope file system access, AsyncStorage, analytics, networking, and other resources per sandbox origin. The mechanism uses a SandboxAwareModule protocol so substituted modules receive sandbox context (origin, requested/resolved module names) at instantiation, enabling path jailing, per-origin storage directories, and similar isolation patterns. The sandbox JS code requires no changes — it uses standard APIs while the swap happens entirely at the native module resolution layer.

6m read timeFrom callstack.com
Post cover image
Table of contents
The problem: Shared resources in TurboModulesThe solution: turboModuleSubstitutionsMaking modules sandbox-awareReal-world example: file system and storage isolationBeyond file system: other scenariosConclusion

Sort: