The following sections provide instructions to build and run the app for development purposes.
To run the project you need to install the correct version of NodeJS and Ruby. We recommend the use of a virtual environment of your choice. For ease of use, this guide adopts nodenv for NodeJS, rbenv for Ruby.
The node version used in this project is stored in .node-version, while the version of Ruby is stored in .ruby-version.
Follow the official tutorial for installing the React Native CLI
for your operating system.
If you have a macOS system, you can follow both the tutorial for iOS and for Android. If you have a Linux or Windows system, you need only to install the development environment for Android.
In order to build the app, we use yarn for managing javascript dependencies.
As stated previously, we also use nodenv
and rbenv
for managing the environment:
# Clone the repository
$ git clone https://github.com/pagopa/io-eudiw-app
# CD into the repository
$ cd io-eudiw-app
# Install NodeJS with nodenv, the returned version should match the one in the .node-version file
$ nodenv install && nodenv version
# Install Ruby with rbenv, the returned version should match the one in the .ruby-version file
$ rbenv install && rbenv version
# Install yarn and rehash to install shims
$ npm install -g yarn && nodenv rehash
# Install bundle
$ gem install bundle
# Install the required Gems from the Gemfile
# Run this only during the first setup and when Gems dependencies change
$ bundle install
# Install dependencies
# Run this only during the first setup and when JS dependencies change
$ yarn install
# Install podfiles when targeting iOS (ignore this step for Android)
# Run this only during the first setup and when Pods dependencies change
$ cd iOS && bundle exec pod install && cd ..
You can target the production server by copying the included .env.production
file to .env
:
$ cp .env.production .env
Note
The sample configuration sets the app to interface with our test environment, on which we work continuously; therefore, it may occur that some features are not always available or fully working. Check the comments in the file for more informations about environment variables.
You can target the development server by copying the included .env.local
file to .env
:
$ cp .env.local .env
An Android Emulator must be created and launched manually.
Then, from your command line, run these commands:
# Perform the port forwarding
$ adb reverse tcp:8081 tcp:8081;adb reverse tcp:3000 tcp:3000;adb reverse tcp:9090 tcp:9090
# Run Android build
$ yarn run-android
However the Android Emulator is not fully supported because it doesn't support the hardware-backed keystore.
# Run iOS build
$ yarn run-ios
The React Native documentation provides a useful guide for running projects on physical devices.
Important
For building the app on an iOS physical device, a few additional steps are necessary:
- Navigate to
Build Phases
in Xcode and expandBundle React Native code and images
. Update theNODE_BINARY
variable with the path to your Node.js environment. You can find the correct path by runningwhich node
in a terminal from the app's root directory; - If you're not part of the PagoPA S.p.A. organization then you must change the
Bundle Identifier
to something unique. This adjustment can be made in theSigning (Debug)
section of Xcode;