Start Metro
Metro is the JavaScript bundler for React Native. Start it before running debug builds:RCT_METRO_PORT in default.env).
Metro must be running for debug builds. Release builds bundle the JavaScript and don’t need Metro.
iOS
Setup
Run the setup script from the project root the first time, and again after dependency changes:pod install.
Build and run
- Open
ios/sdk-ios-demo.xcworkspacein Xcode. - Select your target device or simulator.
- Press Cmd+R to build and run.
Always open the
.xcworkspace file, not the .xcodeproj. The workspace includes CocoaPods dependencies.Android
Setup
android/ directory in Android Studio.
Build and run
- Let Gradle sync finish (this happens automatically on first open).
- Select your target device or emulator.
- Click Run (or press Ctrl+R).
Gradle automatically runs
adb reverse to forward the Metro port from the device to your machine. No manual port forwarding needed.Build types
| Debug | Release | |
|---|---|---|
| JavaScript | Loaded from Metro (live reload) | Bundled into the app binary |
| Metro required | Yes | No |
| Use case | Development | Production / testing |
Environment configuration
The project reads configuration from environment files in this order:default.env— Checked into the repo with sensible defaults..env— Your local overrides (git-ignored).
| Variable | Default | Description |
|---|---|---|
CHOICELY_APP_KEY | Demo app key | Your app key from Choicely Studio |
RCT_METRO_PORT | 8932 | Metro bundler port |
CHOICELY_API_BASE | https://cloud.choicely.com | Choicely API endpoint |
Troubleshooting
Metro not connecting
- Make sure Metro is running (
npm start). - iOS simulator: Should connect automatically.
- Android emulator: Gradle runs
adb reverseautomatically. If it doesn’t work, run manually: - Physical device: Ensure your device and computer are on the same Wi-Fi network.
Pod install fails
Re-run the full setup script to start from a clean state:Component not found
- Verify the component is added to
componentMappinginrn/src/index.js. - Confirm the key matches the URL path exactly (e.g.
my_componentforchoicely://special/rn/my_component). - Restart Metro after adding new components.
