Native Setup Guide
Clone the repository
The first step is to clone the React Native repository to your local machine. It is strongly recommended you clone a new copy of the repo in a new directory, this is because of how easy it is to mess something up with either the git submodules or environment differences and having to deal with difficult and time consuming build errors.
Due to some weird rare issues that can occur due to our repository being named react-native
but also using a library called react-native
, it is recommended that you use a custom directory name, e.g. "entain-native-apps", when you clone the repository, rather than cloning it to the default folder name react-native
E.g:
git clone https://git.neds.sh/technology/code/ui/react-native.git entain-native-apps
Follow native project specific setup
The two platforms (Android and iOS) are effectively two separate projects now, and so their setup is slightly different.
Both project READMEs contain the steps needed for setup, so follow them to get both platforms running.
- Apple: https://ios-technology-code-native-91849f45729902f1da1be55904c0a01cbffd.pages.neds.sh/General/documentation/general/legacy-readme
- Android: https://git.neds.sh/technology/code/native/android
Initial React Native setup
Once you've cloned the repo, pulled the git submodules, and run through the native project setup guides, follow the first time setup guide to setup the React Native environment, tools and dependencies as you normally would.
Running the app
When running the native rebuild apps it's strongly recommended you use the respective native IDEs to launch the app. This allows for better debugging, better integration with the native platforms, and ultimately that is where native development will happen so being comfortable with them will be a huge advantage as the projects progress.
The steps to run the native apps are:
- Start metro with
yarn <brand>
e.g.yarn ladbrokes
oryarn neds
- This will correctly set the
native-rebuild.config.json
file so that React Native knows to use the new native code instead of the old code.
- This will correctly set the
- Run
yarn pod
- This will use the new
ios-rebuild/Podfile
instead of the previousios/Podfile
and install the pods for the correct iOS project.
- This will use the new
Running Android:
- Open Android Studio and open the
android-rebuild
folder. - Set the correct Build Variant.
- For example, if wanting to run Ladbrokes UAT you would select the
LadbrokesUatDebug
build variant.
- For example, if wanting to run Ladbrokes UAT you would select the
- Allow Android Studio to complete any initial tasks that may be running, progress is generally indicated by a loading bar in the bottom right of the IDE.
- Press the play button in the top left of the IDE.
Running iOS:
- Open Xcode and select the
mobile.xcworkspace
file inside theios-rebuild
folder. - Select the target and device you want to run the app on using the dropdowns in the centre top of the IDE.
- For example, to run Ladbrokes UAT you would select Ladbrokes UAT in the dropdown.
- Click the play (build) button.