Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,35 @@ jobs:
working-directory: packages/react-native-sandbox
run: npm pack

test:
runs-on: macos-15
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install asdf
uses: asdf-vm/actions/setup@v4

- name: Tools cache
id: asdf-cache
uses: actions/cache@v4
with:
path: ~/.asdf/
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }}

- name: Install tools from .tool-versions
if: steps.asdf-cache.outputs.cache-hit != 'true'
uses: asdf-vm/actions/install@v4

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Run Test
run: bun run test

example-compilation:
runs-on: macos-15
needs: [lint, test]
strategy:
matrix:
example: [demo] # side-by-side, recursive, fs-experiment
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,13 @@ AppRegistry.registerComponent("SandboxApp", () => App);

Full examples:

- [`apps/demo`](./apps/demo/README.md): Security demo.
- [`apps/side-by-side`](./apps/side-by-side/README.md): An example application with two sandbox instances.
- [`apps/recursive`](./apps/recursive/README.md): An example application with few nested sandbox instances.
- [`apps/demo`](./apps/demo/README.md): Security demo.
- [`apps/p2p-counter`](./apps/p2p-counter/README.md): Direct sandbox-to-sandbox communication demo.




## 📚 API Reference

Expand All @@ -155,7 +159,7 @@ For comprehensive API documentation, installation instructions, and advanced usa
We're actively working on expanding the capabilities of `react-native-sandbox`. Here's what's planned:

- [ ] **Android Support** - Full cross-platform compatibility
- [ ] **Inter-Sandbox Communication** - Secure direct communication between sandbox instances
- [x] **Inter-Sandbox Communication** - Secure direct communication between sandbox instances
- [ ] **[RE.Pack](https://github.com/callstack/repack) Integration** - Advanced bundling and module federation
- Hot-reloading for sandbox instances in development
- Dynamic bundle fetching from remote sources
Expand Down
4 changes: 2 additions & 2 deletions apps/demo/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Toast from 'react-native-toast-message'

import CrashIfYouCanDemo from './CrashIfYouCanDemo'

const SideBySideDemo: React.FC = () => {
const DemoApp: React.FC = () => {
return (
<SafeAreaView>
<View style={styles.container}>
Expand Down Expand Up @@ -69,4 +69,4 @@ const styles = StyleSheet.create({
},
})

export default SideBySideDemo
export default DemoApp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "cs-gradient.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "cs-gradient.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "cs-gradient.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
40 changes: 33 additions & 7 deletions apps/demo/ios/Demo/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23727" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23721"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand All @@ -16,32 +17,57 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Demo" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
<rect key="frame" x="0.0" y="202" width="375" height="43"/>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="cs-gradient" translatesAutoresizingMaskIntoConstraints="NO" id="bg-image">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="{callstack}" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="callstack-label">
<rect key="frame" x="233.5" y="20" width="91.5" height="21"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="center" lineBreakMode="middleTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
<rect key="frame" x="0.0" y="225" width="375" height="86"/>
<string key="text">Sandbox:
Security Demo</string>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="MN2-I3-ftu">
<rect key="frame" x="0.0" y="626" width="375" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="Bcu-3y-fUS" firstAttribute="bottom" secondItem="MN2-I3-ftu" secondAttribute="bottom" constant="20" id="OZV-Vh-mqD"/>
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
<constraint firstItem="MN2-I3-ftu" firstAttribute="centerX" secondItem="Bcu-3y-fUS" secondAttribute="centerX" id="akx-eg-2ui"/>
<constraint firstItem="bg-image" firstAttribute="bottom" secondItem="Ze5-6b-2t3" secondAttribute="bottom" id="bg-bottom"/>
<constraint firstItem="bg-image" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="bg-leading"/>
<constraint firstItem="bg-image" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="bg-top"/>
<constraint firstItem="bg-image" firstAttribute="trailing" secondItem="Ze5-6b-2t3" secondAttribute="trailing" id="bg-trailing"/>
<constraint firstItem="callstack-label" firstAttribute="top" secondItem="Bcu-3y-fUS" secondAttribute="top" id="callstack-top"/>
<constraint firstItem="Bcu-3y-fUS" firstAttribute="trailing" secondItem="callstack-label" secondAttribute="trailing" constant="50" id="callstack-trailing"/>
<constraint firstItem="MN2-I3-ftu" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" id="i1E-0Y-4RG"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="2/5" constant="1" id="moa-c2-u7t"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" symbolic="YES" id="x7j-FC-K8j"/>
</constraints>
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="52.173913043478265" y="375"/>
</scene>
</scenes>
<resources>
<image name="cs-gradient" width="300" height="533.5"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
4 changes: 2 additions & 2 deletions apps/demo/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2019,7 +2019,7 @@ PODS:
- React-timing
- React-utils
- SocketRocket
- React-Sandbox (0.2.0):
- React-Sandbox (0.4.0):
- boost
- DoubleConversion
- fast_float
Expand Down Expand Up @@ -2451,7 +2451,7 @@ SPEC CHECKSUMS:
React-runtimeexecutor: 17c70842d5e611130cb66f91e247bc4a609c3508
React-RuntimeHermes: 3c88e6e1ea7ea0899dcffc77c10d61ea46688cfd
React-runtimescheduler: 024500621c7c93d65371498abb4ee26d34f5d47d
React-Sandbox: 789583cf1f6db8c2bf95e54125aef4314fe9d8ca
React-Sandbox: e3cf3c955559ed9f0bf014b29dce1e94600cd790
React-timing: c3c923df2b86194e1682e01167717481232f1dc7
React-utils: 9154a037543147e1c24098f1a48fc8472602c092
ReactAppDependencyProvider: afd905e84ee36e1678016ae04d7370c75ed539be
Expand Down
4 changes: 4 additions & 0 deletions apps/demo/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
module.exports = {
preset: 'react-native',
transformIgnorePatterns: [
'node_modules/(?!(react-native|@react-native|@react-native-community|@callstack/react-native-sandbox|react-native-toast-message|react-native-reanimated)/)',
],
setupFilesAfterEnv: ['<rootDir>/../../jest.setup.js'],
}
3 changes: 2 additions & 1 deletion apps/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"test": "jest"
},
"dependencies": {
"react": "19.1.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "cs-gradient.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "cs-gradient.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "cs-gradient.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Loading