# React Native

Source: https://help.testapp.io/react-native/

Build your React Native app and send it to your testers with one extra command. This guide is for projects with `android/` and `ios/` folders (React Native CLI, or Expo after prebuild). Building with Expo EAS? Use the Expo EAS guides instead. You can upload with **ta-cli** (the quickest way) or with the **fastlane plugin** if you already use fastlane.

## Before you start

- An **API token**: create one at [https://portal.testapp.io/profile/tokens](https://portal.testapp.io/profile/tokens)
- Your **App ID**: open your app in the portal ([https://portal.testapp.io/apps](https://portal.testapp.io/apps)), go to Integrations → Releases, pick any tool, and copy the App ID from the setup panel.

## Option 1: Upload with ta-cli (easiest)

Install ta-cli once:

```bash
curl -Ls https://github.com/testappio/cli/releases/latest/download/install | bash
```

### Android

```bash
cd android && ./gradlew assembleRelease && cd ..
ta-cli publish --api_token=$TESTAPPIO_API_TOKEN --app_id=$TESTAPPIO_APP_ID --release=android --apk=android/app/build/outputs/apk/release/app-release.apk --git_release_notes=true --notify=true --source="React Native"
```

Release signing is covered in the React Native docs: [https://reactnative.dev/docs/signed-apk-android](https://reactnative.dev/docs/signed-apk-android)

### iOS

Testers can only install an IPA signed with an **Ad Hoc** or **Development** profile that includes their devices. Archive and export the IPA from Xcode (Product > Archive > Distribute App > Ad Hoc) or with fastlane, then upload it:

```bash
ta-cli publish --api_token=$TESTAPPIO_API_TOKEN --app_id=$TESTAPPIO_APP_ID --release=ios --ipa=/path/to/YourApp.ipa --git_release_notes=true --notify=true --source="React Native"
```

## Option 2: Upload with the fastlane plugin

Already using fastlane? The TestApp.io plugin builds on the same ta-cli upload and fits into your existing lanes. It needs Ruby 3.0 or newer. See the [fastlane plugin guide](https://help.testapp.io/fastlane-plugin/) for every option.

Install the plugin from your project root (create the `fastlane` folder first with `fastlane init` if you don't have one):

```bash
fastlane add_plugin testappio
```

Add two lanes to `fastlane/Fastfile`. Lanes run inside the `fastlane` folder, so file paths start with `../`. Replace `YourApp` with your Xcode workspace and scheme names:

```ruby
lane :beta_android do
  sh("cd ../android && ./gradlew assembleRelease")

  upload_to_testappio(
    api_token:         ENV["TESTAPPIO_API_TOKEN"],
    app_id:            ENV["TESTAPPIO_APP_ID"],
    release:           "android",
    apk_file:          "../android/app/build/outputs/apk/release/app-release.apk",
    git_release_notes: true,
    notify:            true
  )
end

lane :beta_ios do
  build_app(
    workspace:     "../ios/YourApp.xcworkspace",
    scheme:        "YourApp",
    export_method: "ad-hoc"
  )

  upload_to_testappio(
    api_token:         ENV["TESTAPPIO_API_TOKEN"],
    app_id:            ENV["TESTAPPIO_APP_ID"],
    release:           "ios",
    ipa_file:          lane_context[SharedValues::IPA_OUTPUT_PATH],
    git_release_notes: true,
    notify:            true
  )
end
```

Run a lane with `fastlane beta_android` or `fastlane beta_ios`. To upload both files at once, use `release: "both"` and pass `apk_file` and `ipa_file`. The plugin marks the upload as coming from fastlane for you, so there is no `source` option to set. Signing for iOS is covered in [Setup iOS Project for Fastlane](https://help.testapp.io/setup-ios-project-for-fastlane/).

## In CI

Run the same commands as the last step of your pipeline and store the token and App ID as secret variables. We have guides for GitHub Actions, GitLab CI/CD, Bitbucket Pipelines, Codemagic, Bitrise, CircleCI, Jenkins, Azure Pipelines and Xcode Cloud.

> **Tip:** Once your pipeline uploads a build, team members using the [TestApp.io mobile app](https://help.testapp.io/mobile-app-getting-started/) receive a push notification and can install the build with a single tap. You can also create [share links](https://help.testapp.io/how-to-share/) to distribute builds to external testers and clients.

---

Need help? [Contact us](https://testapp.io/contact-us/). we're happy to assist!
