This repository is for Source of Truth, a mobile app to act as a single point of reference for information about AND Somerville.
This guide assumes you are setting this up on OSX. You should have homebrew and git installed.
Follow the React Native CLI Quickstart setup for MacOS with target OS as Android. Ignore the part about setting up a new app, but ensure you've followed the subsequent instructions to create a virtual Android device in Android studio.
The above instructions will have installed the Azul Zulu OpenJDK version of Java 11. You should ensure the JAVA_HOME environment variable points to the Java 11 OpenJDK. The easiest way to manage this is to install jEnv, a tool for managing multiple Java versions:
- install jEnv:
brew install jenv
- add the zulu11 OpenJDK installation directory to the Java versions jEnv knows about. For an x86 mac, this should be:
jenv add /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home
JAVA_HOME
should now point to Java 11 when inside this repo, as it will be picked up from the.java-version
file. You can check this withecho $JAVA_HOME
[TODO]
- Clone this repository, and from within the
source-of-truth
folder, executenpm install
- You will need to add some environment variables to a .env file to provide the appropriate Contentful space and API key to the app. Reach out to one of the existing devs for what these should be, otherwise the app will just display a 401 error.
Common development commands are defined as scripts in package.json
:
npm run android
- start the react packager/server and the android simulatornpm run ios
- start the react packager/server and the iOS simulatornpm run lint
- Run ESLintnpm start
- start the react packager/servernpm test
- Run the test suite
In order for use to use a custom font on the app we have to use custom components to apply the style to the text
You can find these in components/Text
. Use these components instead of the default <Text>
so the text styling is consistent accross the app.
If you need to add a new font to the app, add the file in assets/fonts
and run the command npx react-native-asset
in the terminal.
If you need to use a different style of text to the ones already present, create a new component in components/Text
following the same structure as the other ones and adjusting the styling to your needs.