This is a React Native example app for Chrome Remote DevTools that demonstrates session recording functionality.
Before you begin, ensure you have completed the React Native Environment Setup guide.
- Node.js >= 20 (managed by mise)
- Bun (managed by mise)
- Ruby 3.3 (managed by mise, for iOS CocoaPods)
- React Native CLI
- Android Studio (for Android development)
- Xcode (for iOS development, macOS only)
This project uses mise for tool version management. The required tools are automatically installed when you run mise install:
# From project root
mise install
# Or from examples/react-native
cd examples/react-native
mise installFrom the project root, install workspace dependencies:
# Using bun (recommended)
bun install
# OR using npm
npm installThen, navigate to the React Native example directory:
cd examples/react-nativeInstall React Native dependencies:
# Using bun
bun install
# OR using npm
npm installCopy necessary native files (gradlew, Xcode projects, etc.) from the hwpjs example:
cd examples/react-native
./scripts/copy-native-files.shThis script will copy:
- Android
gradlewandgradlew.batfiles (already created, but script will ensure they're up to date) - Android
gradle-wrapper.jar(binary file, must be copied manually) - iOS Xcode project files (
.xcodeprojand.xcworkspace) - Required for pod install - iOS
LaunchScreen.storyboard(already created) - iOS
Images.xcassets(already created) - iOS
PrivacyInfo.xcprivacy(already created)
Important: If the script fails or Xcode project files are missing, copy them manually:
cd examples/react-native
# Copy Xcode project
cp -r ../../hwpjs/examples/react-native/ios/ReactNativeExample.xcodeproj ios/ChromeRemoteDevTools.xcodeproj
# Copy Xcode workspace
cp -r ../../hwpjs/examples/react-native/ios/ReactNativeExample.xcworkspace ios/ChromeRemoteDevTools.xcworkspace
# Rename references in project files
find ios/ChromeRemoteDevTools.xcodeproj -type f -name "*.pbxproj" -exec sed -i '' 's/ReactNativeExample/ChromeRemoteDevTools/g' {} \;
find ios/ChromeRemoteDevTools.xcworkspace -type f -exec sed -i '' 's/ReactNativeExample/ChromeRemoteDevTools/g' {} \;
# Copy gradle-wrapper.jar
cp ../../hwpjs/examples/react-native/android/gradle/wrapper/gradle-wrapper.jar android/gradle/wrapper/Note: The script will automatically rename references from ReactNativeExample to ChromeRemoteDevTools.
Important: Before installing CocoaPods, ensure Xcode Command Line Tools are installed:
xcode-select --installFor iOS, you need to install CocoaPods dependencies. First, install the Ruby bundler (first time only):
cd ios
mise exec -- bundle installIf mise exec fails with native extension build errors, try using system Ruby:
/usr/bin/ruby -S bundle installThen install CocoaPods dependencies:
bundle exec pod install
cd ..Note: If you encounter native extension build errors, see the "iOS CocoaPods Installation Issues" section in Troubleshooting.
In a separate terminal, start the Chrome Remote DevTools server from the project root:
# From project root
bun run dev:serverThe server will start on ws://localhost:8080 by default.
Start the Metro bundler from the React Native example directory:
# From examples/react-native
bun run start
# OR
npm startWith Metro running, open a new terminal and run the app:
bun run android
# OR
npm run androidbun run ios
# OR
npm run ios-
Connect to Server:
- On Android emulator/USB device, run once:
adb reverse tcp:8080 tcp:8080. Then use defaultws://localhost:8080. - Enter the server WebSocket URL (default:
ws://localhost:8080) and click "Connect" to establish connection
- On Android emulator/USB device, run once:
-
Start Recording:
- Once connected, click "Start Recording" to begin session recording
- The app will record user interactions and view changes
-
View Recorded Session:
- Open Chrome Remote DevTools Inspector in your browser
- Navigate to the Session Replay panel
- View the recorded session replay
The example uses localhost:8080 for both iOS and Android. On Android emulator or USB device, run once so that localhost reaches the host PC:
adb reverse tcp:8080 tcp:8080Then reload the app. You can change the server in the app's UI or in src/App.tsx (ChromeRemoteDevToolsInspectorProvider serverHost/serverPort).
Session recording is configured in src/App.tsx. You can modify the rrweb settings:
await init({
serverUrl,
rrweb: {
enable: true,
flushIntervalMs: 1000, // Flush interval in milliseconds
maxBatchSize: 50, // Maximum batch size for events
},
});examples/react-native/
├── android/ # Android native project
├── ios/ # iOS native project
├── src/
│ ├── App.tsx # Main app component
│ └── utils/ # Utility functions
├── app.json # App metadata
├── babel.config.js # Babel configuration
├── index.js # Entry point
├── metro.config.js # Metro bundler configuration
├── package.json # Dependencies
└── tsconfig.json # TypeScript configuration
This example app excludes @ohah/chrome-remote-devtools-inspector-react-native from the native build via react-native.config.js (platforms: { android: null, ios: null }). Only the inspector's JavaScript code (WebSocket, console/network hooks) runs; no Kotlin or Swift from that package is built. If you remove that config, the app will link and build the package's android/ and ios/ again.
이 예제 앱은 react-native.config.js에서 @ohah/chrome-remote-devtools-inspector-react-native를 네이티브 빌드에서 제외합니다(platforms: { android: null, ios: null }). 인스펙터의 JavaScript(WebSocket, 콘솔/네트워크 훅)만 실행되며, 해당 패키지의 Kotlin/Swift는 빌드되지 않습니다. 해당 설정을 제거하면 앱이 패키지의 android/, ios/를 다시 링크·빌드합니다.
- Cannot connect to server: Ensure the Chrome Remote DevTools server is running (
bun run dev:server) - WebSocket connection failed: Check that the server URL is correct and the server is accessible
- Android emulator / USB device: Run
adb reverse tcp:8080 tcp:8080once so thatlocalhost:8080in the app reaches the host PC (Android 5.x+)
When running Metro in the monorepo you may see:
- Error: No host header was found — Metro 0.83+ requires a
Hostheader on requests. Some clients or tools may omit it. - ENOENT: no such file or directory, watch '.../target/debug/deps/.tmp...' — Metro is watching the Rust
target/directory; temporary cargo files cause watch errors.
Fixes:
-
Exclude
target/from Metro — The@ohah/chrome-remote-devtools-inspector-react-nativeMetro config already adds ablockListfortarget/. If you still see ENOENT, ensure you are using the latest package and that Metro is loading this config. -
Use the custom server when "No host header" appears — Start Metro with the wrapper that injects a
Hostheader:cd examples/react-native bun run start:with-host # or: node scripts/start-with-host.js
Then run the app as usual (
bun run android/bun run ios).
If you encounter "You have to install development tools first" or native extension build errors:
-
Install Xcode Command Line Tools:
xcode-select --install
Follow the installation prompts and wait for completion.
-
Verify installation:
xcode-select -p # Should output: /Library/Developer/CommandLineTools -
Verify compiler is available:
which gcc which clang
-
Try bundle install again with mise:
cd ios mise exec -- bundle install
-
Alternative: Use system Ruby (if mise Ruby fails):
cd ios /usr/bin/ruby -S bundle install -
Or install CocoaPods directly without bundler:
gem install cocoapods cd ios pod install
Note: The Gemfile has been configured to exclude problematic gem versions that cause build failures. If you still encounter issues, ensure Xcode Command Line Tools are properly installed.
- Android build fails: Ensure Android SDK is properly installed and
ANDROID_HOMEis set - iOS build fails:
- Ensure CocoaPods dependencies are installed:
cd ios && bundle exec pod install - If pod install fails, see "iOS CocoaPods Installation Issues" above
- Ensure CocoaPods dependencies are installed:
- Metro bundler issues: Clear Metro cache with
bun run start --reset-cache
If you encounter issues with React Native setup, refer to the React Native Troubleshooting Guide.
The app supports Fast Refresh. Changes to src/App.tsx will automatically reload in the app.
- Android: Use Chrome DevTools or React Native Debugger
- iOS: Use Safari Web Inspector or React Native Debugger
Run tests with:
bun test
# OR
npm test