Building a React Native app

React Native is a cross-platform solution that allows you to build apps for both iOS and Android faster using a single language. When working with YAML, the basics are still the same, the build scripts are added to the scripts section in the overall architecture.

Android

Set up local properties

- echo "sdk.dir=$HOME/programs/android-sdk-macosx" > "$FCI_BUILD_DIR/android/local.properties"

Building an Android application:

- cd android && ./gradlew build

iOS

Codemagic uses the xcode-project to prepare iOS application code signing properties for build.

Script for building an iOS application:

- xcode-project build-ipa --workspace "ios/MyReact.xcworkspace" --scheme "MyReact"
Read more about different schemes in Apple documentation.

Testing, code signing and publishing

To test and publish a React Native app:

  • The code for testing a React Native app also goes under scripts, before build commands. An example for testing a React Naive app can be found here.
  • All iOS and Android applications need to be signed before release. Different script examples are available here.
  • All generated artifacts can be published to external services. The available integrations currently are email, Slack and Google Play. It is also possible to publish elsewhere with custom scripts (e.g. Firebase App Distribution). Script examples for all of them are available here.