Skip to content

Commit 079156e

Browse files
authored
Merge pull request #7 from callstackincubator/chore/rename-to-sandbox
chore: rename react-native-multinstance to react-native-sandbox
2 parents 5a7e97f + ca92473 commit 079156e

29 files changed

Lines changed: 203 additions & 159 deletions

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<img src="./docs/logo.svg" width="30%" />
33
</p>
44

5-
# react-native-multinstance
5+
# react-native-sandbox
66

7-
[![check](https://github.com/callstackincubator/react-native-multinstance/actions/workflows/check.yml/badge.svg)](https://github.com/callstackincubator/react-native-multinstance/actions/workflows/check.yml)
7+
[![check](https://github.com/callstackincubator/react-native-sandbox/actions/workflows/check.yml/badge.svg)](https://github.com/callstackincubator/react-native-sandbox/actions/workflows/check.yml)
88
![platform: iOS](https://img.shields.io/badge/platform-iOS-blue.svg)
99
![license: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
1010

@@ -17,7 +17,7 @@
1717
- [File System & Storage](#file-system--storage)
1818
- [Platform-Specific](#platform-specific-considerations)
1919

20-
`react-native-multinstance` is a library for running multiple, isolated React Native instances within a single application. This allows you to embed third-party or feature-specific "micro-apps" in a sandboxed environment, preventing uncontrolled interference with the main app by providing a clear API for communication (`postMessage`/`onMessage`).
20+
`react-native-sandbox` is a library for running multiple, isolated React Native instances within a single application. This allows you to embed third-party or feature-specific "micro-apps" in a sandboxed environment, preventing uncontrolled interference with the main app by providing a clear API for communication (`postMessage`/`onMessage`).
2121

2222
## 💡 Project Overview
2323

@@ -29,11 +29,11 @@ This project was born from the need to safely run third-party code within a reac
2929

3030
> Note that `postMessage` only supports serializable data (similar to [`Window.postMessage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#message) in web browsers), meaning no functions, native state, or non-serializable objects can be passed.
3131
32-
`react-native-multinstance` provides the API to create these sandboxed React Native instances with a simple component-based API, requiring no native code to be written by the consumer.
32+
`react-native-sandbox` provides the API to create these sandboxed React Native instances with a simple component-based API, requiring no native code to be written by the consumer.
3333

3434
This project is structured as a monorepo.
3535

36-
- [`packages/react-native-multinstance`](./packages/react-native-multinstance/): the core library.
36+
- [`packages/react-native-sandbox`](./packages/react-native-sandbox/): the core library.
3737
- [`apps/side-by-side`](./apps/side-by-side/README.md): An example application with two sandbox instances.
3838
- [`apps/recursive`](./apps/recursive/README.md): An example application with few nested sandbox instances.
3939

@@ -65,7 +65,7 @@ Here is a brief overview of how to use the library.
6565
```tsx
6666
import React, { useRef } from 'react';
6767
import { View, Button } from 'react-native';
68-
import SandboxReactNativeView, { SandboxReactNativeViewRef } from 'react-native-multinstance';
68+
import SandboxReactNativeView, { SandboxReactNativeViewRef } from 'react-native-sandbox';
6969
7070
function HostApp() {
7171
const sandboxRef = useRef<SandboxReactNativeViewRef>(null);
@@ -131,7 +131,7 @@ AppRegistry.registerComponent("SandboxApp", () => App);
131131
132132
## 🎨 Roadmap
133133
134-
We're actively working on expanding the capabilities of `react-native-multinstance`. Here's what's planned:
134+
We're actively working on expanding the capabilities of `react-native-sandbox`. Here's what's planned:
135135
136136
- [ ] **Android Support** - Full cross-platform compatibility
137137
- [ ] **Inter-Sandbox Communication** - Secure communication between sandbox instances
@@ -149,7 +149,7 @@ We're actively working on expanding the capabilities of `react-native-multinstan
149149
- Secure file system access controls
150150
- [ ] **Developer Tools** - Enhanced debugging and development experience
151151
152-
Contributions and feedback on these roadmap items are welcome! Please check our [issues](https://github.com/your-org/react-native-multinstance/issues) for detailed discussions on each feature.
152+
Contributions and feedback on these roadmap items are welcome! Please check our [issues](https://github.com/callstackincubator/react-native-sandbox/issues) for detailed discussions on each feature.
153153
154154
## 🔒 Security Considerations
155155
@@ -161,7 +161,7 @@ A primary security concern when running multiple React Native instances is the p
161161
- **Data Leakage:** One sandbox could use a shared TurboModule to store data, which could then be read by another sandbox or the host. This breaks the isolation model.
162162
- **Unintended Side-Effects:** A sandbox could call a method on a shared module that changes its state, affecting the behavior of the host or other sandboxes in unpredictable ways.
163163
164-
To address this, `react-native-multinstance` allows you to provide a **whitelist of allowed TurboModules** for each sandbox instance via the `allowedTurboModules` prop. Only the modules specified in this list will be accessible from within the sandbox, significantly reducing the attack surface. It is critical to only whitelist modules that are stateless or are explicitly designed to be shared safely.
164+
To address this, `react-native-sandbox` allows you to provide a **whitelist of allowed TurboModules** for each sandbox instance via the `allowedTurboModules` prop. Only the modules specified in this list will be accessible from within the sandbox, significantly reducing the attack surface. It is critical to only whitelist modules that are stateless or are explicitly designed to be shared safely.
165165
166166
**Default Whitelist:** By default, only `NativeMicrotasksCxx` is whitelisted. Modules like `NativePerformanceCxx`, `PlatformConstants`, `DevSettings`, `LogBox`, and other third-party modules are *not* whitelisted.
167167

apps/fs-experiment/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from 'react-native'
1414
// File system imports
1515
import RNFS from 'react-native-fs'
16-
import SandboxReactNativeView from 'react-native-multinstance'
16+
import SandboxReactNativeView from 'react-native-sandbox'
1717

1818
const SHARED_FILE_PATH = `${RNFS.DocumentDirectoryPath}/shared_test_file.txt`
1919

apps/fs-experiment/ios/Podfile.lock

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,11 +1648,6 @@ PODS:
16481648
- React-RCTFBReactNativeSpec
16491649
- ReactCommon/turbomodule/core
16501650
- SocketRocket
1651-
- React-MultInstance (0.0.1):
1652-
- React-Core
1653-
- React-RCTAppDelegate
1654-
- ReactAppDependencyProvider
1655-
- ReactCommon
16561651
- React-NativeModulesApple (0.80.1):
16571652
- boost
16581653
- DoubleConversion
@@ -2024,6 +2019,35 @@ PODS:
20242019
- React-timing
20252020
- React-utils
20262021
- SocketRocket
2022+
- React-Sandbox (0.0.1):
2023+
- boost
2024+
- DoubleConversion
2025+
- fast_float
2026+
- fmt
2027+
- glog
2028+
- hermes-engine
2029+
- RCT-Folly
2030+
- RCT-Folly/Fabric
2031+
- RCTRequired
2032+
- RCTTypeSafety
2033+
- React-Core
2034+
- React-debug
2035+
- React-Fabric
2036+
- React-featureflags
2037+
- React-graphics
2038+
- React-hermes
2039+
- React-ImageManager
2040+
- React-jsi
2041+
- React-NativeModulesApple
2042+
- React-RCTFabric
2043+
- React-renderercss
2044+
- React-rendererdebug
2045+
- React-utils
2046+
- ReactCodegen
2047+
- ReactCommon/turbomodule/bridging
2048+
- ReactCommon/turbomodule/core
2049+
- SocketRocket
2050+
- Yoga
20272051
- React-timing (0.80.1)
20282052
- React-utils (0.80.1):
20292053
- boost
@@ -2205,7 +2229,6 @@ DEPENDENCIES:
22052229
- React-logger (from `../../../node_modules/react-native/ReactCommon/logger`)
22062230
- React-Mapbuffer (from `../../../node_modules/react-native/ReactCommon`)
22072231
- React-microtasksnativemodule (from `../../../node_modules/react-native/ReactCommon/react/nativemodule/microtasks`)
2208-
- React-MultInstance (from `../../../node_modules/react-native-multinstance`)
22092232
- React-NativeModulesApple (from `../../../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`)
22102233
- React-oscompat (from `../../../node_modules/react-native/ReactCommon/oscompat`)
22112234
- React-perflogger (from `../../../node_modules/react-native/ReactCommon/reactperflogger`)
@@ -2232,6 +2255,7 @@ DEPENDENCIES:
22322255
- React-runtimeexecutor (from `../../../node_modules/react-native/ReactCommon/runtimeexecutor`)
22332256
- React-RuntimeHermes (from `../../../node_modules/react-native/ReactCommon/react/runtime`)
22342257
- React-runtimescheduler (from `../../../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`)
2258+
- React-Sandbox (from `../../../node_modules/react-native-sandbox`)
22352259
- React-timing (from `../../../node_modules/react-native/ReactCommon/react/timing`)
22362260
- React-utils (from `../../../node_modules/react-native/ReactCommon/react/utils`)
22372261
- ReactAppDependencyProvider (from `build/generated/ios`)
@@ -2329,8 +2353,6 @@ EXTERNAL SOURCES:
23292353
:path: "../../../node_modules/react-native/ReactCommon"
23302354
React-microtasksnativemodule:
23312355
:path: "../../../node_modules/react-native/ReactCommon/react/nativemodule/microtasks"
2332-
React-MultInstance:
2333-
:path: "../../../node_modules/react-native-multinstance"
23342356
React-NativeModulesApple:
23352357
:path: "../../../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios"
23362358
React-oscompat:
@@ -2383,6 +2405,8 @@ EXTERNAL SOURCES:
23832405
:path: "../../../node_modules/react-native/ReactCommon/react/runtime"
23842406
React-runtimescheduler:
23852407
:path: "../../../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler"
2408+
React-Sandbox:
2409+
:path: "../../../node_modules/react-native-sandbox"
23862410
React-timing:
23872411
:path: "../../../node_modules/react-native/ReactCommon/react/timing"
23882412
React-utils:
@@ -2441,7 +2465,6 @@ SPEC CHECKSUMS:
24412465
React-logger: 984ebd897afad067555d081deaf03f57c4315723
24422466
React-Mapbuffer: 0c045c844ce6d85cde53e85ab163294c6adad349
24432467
React-microtasksnativemodule: d9499269ad1f484ae71319bac1d9231447f2094e
2444-
React-MultInstance: 316d4720cde73e6462eced209c7916e2353135be
24452468
React-NativeModulesApple: 983f3483ef0a3446b56d490f09d579fba2442e17
24462469
React-oscompat: 114036cd8f064558c9c1a0c04fc9ae5e1453706a
24472470
React-perflogger: e7287fee27c16e3c8bd4d470f2361572b63be16b
@@ -2468,6 +2491,7 @@ SPEC CHECKSUMS:
24682491
React-runtimeexecutor: 17c70842d5e611130cb66f91e247bc4a609c3508
24692492
React-RuntimeHermes: 3c88e6e1ea7ea0899dcffc77c10d61ea46688cfd
24702493
React-runtimescheduler: 024500621c7c93d65371498abb4ee26d34f5d47d
2494+
React-Sandbox: 54c22e07b36020687c46ee4b726f7bf0cc919494
24712495
React-timing: c3c923df2b86194e1682e01167717481232f1dc7
24722496
React-utils: 9154a037543147e1c24098f1a48fc8472602c092
24732497
ReactAppDependencyProvider: afd905e84ee36e1678016ae04d7370c75ed539be

apps/fs-experiment/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"dependencies": {
1414
"react": "19.1.0",
1515
"react-native": "0.80.1",
16-
"react-native-multinstance": "workspace:*",
16+
"react-native-sandbox": "workspace:*",
1717
"react-native-fs": "^2.20.0",
1818
"react-native-file-access": "^3.1.1"
1919
},

apps/recursive/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
useColorScheme,
99
View,
1010
} from 'react-native'
11-
import SandboxReactNativeView from 'react-native-multinstance'
11+
import SandboxReactNativeView from 'react-native-sandbox'
1212

1313
const Colors = {
1414
light: '#ffffff',

apps/recursive/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
![Platform: iOS](https://img.shields.io/badge/platform-iOS-blue.svg)
44

5-
This example demonstrates the capability of `react-native-multinstance` to create and manage nested React Native instances. The application recursively renders `SandboxReactNativeView` components, each encapsulating another instance of the same application, up to a predefined maximum depth.
5+
This example demonstrates the capability of `react-native-sandbox` to create and manage nested React Native instances. The application recursively renders `SandboxReactNativeView` components, each encapsulating another instance of the same application, up to a predefined maximum depth.
66

77
<div align="center">
88
<img src="./docs/screenshot.png" width="240" />

apps/recursive/RecursiveDisplay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
22
import {StyleSheet, Text, View} from 'react-native'
3-
import SandboxReactNativeView from 'react-native-multinstance'
3+
import SandboxReactNativeView from 'react-native-sandbox'
44

55
const MAX_DEPTH = 5
66

apps/recursive/ios/Podfile.lock

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,11 +1648,6 @@ PODS:
16481648
- React-RCTFBReactNativeSpec
16491649
- ReactCommon/turbomodule/core
16501650
- SocketRocket
1651-
- React-MultInstance (0.0.1):
1652-
- React-Core
1653-
- React-RCTAppDelegate
1654-
- ReactAppDependencyProvider
1655-
- ReactCommon
16561651
- React-NativeModulesApple (0.80.1):
16571652
- boost
16581653
- DoubleConversion
@@ -2024,6 +2019,35 @@ PODS:
20242019
- React-timing
20252020
- React-utils
20262021
- SocketRocket
2022+
- React-Sandbox (0.0.1):
2023+
- boost
2024+
- DoubleConversion
2025+
- fast_float
2026+
- fmt
2027+
- glog
2028+
- hermes-engine
2029+
- RCT-Folly
2030+
- RCT-Folly/Fabric
2031+
- RCTRequired
2032+
- RCTTypeSafety
2033+
- React-Core
2034+
- React-debug
2035+
- React-Fabric
2036+
- React-featureflags
2037+
- React-graphics
2038+
- React-hermes
2039+
- React-ImageManager
2040+
- React-jsi
2041+
- React-NativeModulesApple
2042+
- React-RCTFabric
2043+
- React-renderercss
2044+
- React-rendererdebug
2045+
- React-utils
2046+
- ReactCodegen
2047+
- ReactCommon/turbomodule/bridging
2048+
- ReactCommon/turbomodule/core
2049+
- SocketRocket
2050+
- Yoga
20272051
- React-timing (0.80.1)
20282052
- React-utils (0.80.1):
20292053
- boost
@@ -2172,7 +2196,6 @@ DEPENDENCIES:
21722196
- React-logger (from `../../../node_modules/react-native/ReactCommon/logger`)
21732197
- React-Mapbuffer (from `../../../node_modules/react-native/ReactCommon`)
21742198
- React-microtasksnativemodule (from `../../../node_modules/react-native/ReactCommon/react/nativemodule/microtasks`)
2175-
- React-MultInstance (from `../../../node_modules/react-native-multinstance`)
21762199
- React-NativeModulesApple (from `../../../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`)
21772200
- React-oscompat (from `../../../node_modules/react-native/ReactCommon/oscompat`)
21782201
- React-perflogger (from `../../../node_modules/react-native/ReactCommon/reactperflogger`)
@@ -2199,6 +2222,7 @@ DEPENDENCIES:
21992222
- React-runtimeexecutor (from `../../../node_modules/react-native/ReactCommon/runtimeexecutor`)
22002223
- React-RuntimeHermes (from `../../../node_modules/react-native/ReactCommon/react/runtime`)
22012224
- React-runtimescheduler (from `../../../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`)
2225+
- React-Sandbox (from `../../../node_modules/react-native-sandbox`)
22022226
- React-timing (from `../../../node_modules/react-native/ReactCommon/react/timing`)
22032227
- React-utils (from `../../../node_modules/react-native/ReactCommon/react/utils`)
22042228
- ReactAppDependencyProvider (from `build/generated/ios`)
@@ -2293,8 +2317,6 @@ EXTERNAL SOURCES:
22932317
:path: "../../../node_modules/react-native/ReactCommon"
22942318
React-microtasksnativemodule:
22952319
:path: "../../../node_modules/react-native/ReactCommon/react/nativemodule/microtasks"
2296-
React-MultInstance:
2297-
:path: "../../../node_modules/react-native-multinstance"
22982320
React-NativeModulesApple:
22992321
:path: "../../../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios"
23002322
React-oscompat:
@@ -2347,6 +2369,8 @@ EXTERNAL SOURCES:
23472369
:path: "../../../node_modules/react-native/ReactCommon/react/runtime"
23482370
React-runtimescheduler:
23492371
:path: "../../../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler"
2372+
React-Sandbox:
2373+
:path: "../../../node_modules/react-native-sandbox"
23502374
React-timing:
23512375
:path: "../../../node_modules/react-native/ReactCommon/react/timing"
23522376
React-utils:
@@ -2401,7 +2425,6 @@ SPEC CHECKSUMS:
24012425
React-logger: 984ebd897afad067555d081deaf03f57c4315723
24022426
React-Mapbuffer: 0c045c844ce6d85cde53e85ab163294c6adad349
24032427
React-microtasksnativemodule: d9499269ad1f484ae71319bac1d9231447f2094e
2404-
React-MultInstance: 316d4720cde73e6462eced209c7916e2353135be
24052428
React-NativeModulesApple: 983f3483ef0a3446b56d490f09d579fba2442e17
24062429
React-oscompat: 114036cd8f064558c9c1a0c04fc9ae5e1453706a
24072430
React-perflogger: e7287fee27c16e3c8bd4d470f2361572b63be16b
@@ -2428,6 +2451,7 @@ SPEC CHECKSUMS:
24282451
React-runtimeexecutor: 17c70842d5e611130cb66f91e247bc4a609c3508
24292452
React-RuntimeHermes: 3c88e6e1ea7ea0899dcffc77c10d61ea46688cfd
24302453
React-runtimescheduler: 024500621c7c93d65371498abb4ee26d34f5d47d
2454+
React-Sandbox: 54c22e07b36020687c46ee4b726f7bf0cc919494
24312455
React-timing: c3c923df2b86194e1682e01167717481232f1dc7
24322456
React-utils: 9154a037543147e1c24098f1a48fc8472602c092
24332457
ReactAppDependencyProvider: afd905e84ee36e1678016ae04d7370c75ed539be

apps/recursive/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"dependencies": {
1111
"react": "19.1.0",
1212
"react-native": "0.80.1",
13-
"react-native-multinstance": "workspace:*"
13+
"react-native-sandbox": "workspace:*"
1414
},
1515
"devDependencies": {
1616
"@babel/core": "^7.25.2",

apps/side-by-side/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import {
88
Switch,
99
View,
1010
} from 'react-native'
11-
import SandboxReactNativeView, {
12-
SandboxReactNativeViewRef,
13-
} from 'react-native-multinstance'
1411
import Animated, {
1512
useAnimatedStyle,
1613
useDerivedValue,
1714
useSharedValue,
1815
} from 'react-native-reanimated'
16+
import SandboxReactNativeView, {
17+
SandboxReactNativeViewRef,
18+
} from 'react-native-sandbox'
1919
import Toast, {BaseToast, ToastConfigParams} from 'react-native-toast-message'
2020

2121
const {width: screenWidth, height: screenHeight} = Dimensions.get('window')

0 commit comments

Comments
 (0)