Nona - React Native Template
- Splashscreen Customisation
- Android Build Notes
- Setup Notes
- Screenshot Generation
- Semantic Release
- Use with React Native CLI
- Consistent with the default React Native template
- Has the following built in:
- React Navigation
- Redux Toolkit
- Redux Observable
- React Native SVG
- Storybook with examples
- Documentation with comprehensive README.md, gotchas, project structure listed
- Example CircleCI deploy scripts which can be edited, tailored to your needs.
- Semantic Release to generate releases based on commit messages as well as release notes for Testflight/Google Play.
- All Nona linting and prettier standards with some changes.
- Editorconfig defined
- Sentry integrated with redux breadcrumbs (You just need to fill in the credentials)
- Flipper Support with Redux Debugger Plugin Installed for viewing of Redux actions in Flipper
- Unimodule Suport allowing use and easy installation of Expo modules
- Expo Splash Screen
Init the project with the following command:
npx react-native init MyApp --template nona
Read your new projects README.md and docs to get started, and edit if you want to change anything.
The quickest way to run the application:
- Install Gemfiles from the root with
npm run env:developmentto generate an env file
npm run startto start your bundler
npm run iosor
npm run android
- This template makes use of 'expo-splash-screen' to show a splashscreen on startup. You can refer to the documentation here for where to change this in your project (it involves opening the project in xCode), making some changes to the Android project.
Android Build Notes
Some changes have been made to the Android build settings via setting certain properties in gradle.properties. At present they are:
org.gradle.daemon=true org.gradle.configureondemand=true org.gradle.jvmargs=-Xmx2048M -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
Feel free to change them as you see fit.
This project has husky hooks at .husky. You should follow the guide setting up Husky here. To avoid installing these hooks on ci you can add the following to your scripts.
"prepare": "is-ci || husky install"
The CircleCI config is included as an example of how you might go about setting up the project to build and deploy. Feel free to change it as you see fit. Things to note include:
- In this config, the keystore files are hosted on an S3 bucket and downloaded at build time. You can see from config.yml that this is at:
echo 'export S3_URL=s3://$ANDROID_KEYSTORE_BUCKET/<< parameters.stage >>/' >> $BASH_ENV
So you would need to define that in your environment, and store the keystore in that bucket for this to work. You can also see that from
ptemplate/android/fastlane/Fastfile that it is copying from the region eu-west-1, so if your bucket is in a different region you will have to change that.
Environment variables that you will need set in your project in CircleCI and what they do:
- GH_TOKEN - A GitHub personal access token, that Semantic release will use to create release commits.
- ANDROID_KEYSTORE_BUCKET - bucket name that houses your Android keystore files
- ANDROID_KEYSTORE_PASSWORD - Android Keystore Password
- AWS_ACCESS_KEY_ID - AWS access key
- AWS_SECRET_ACCESS_KEY - AWS secret access key
- APP_STORE_CONNECT_KEY_ID - The Appstore Connect Key ID That you are using. (see here)
- APP_STORE_CONNECT_ISSUER_ID - See here
- APP_STORE_CONNECT_API_KEY_B64 - The Base64 encoded API key - See here.
Environment variables that you may want to change in config.yml and what they do:
- KEY_FILE - Key file for the Android Keystore
- KEY_ALIAS - Alias for the Android Keystore
Fastfiles are provided but you will have to change some of the details to get things to work, and go through setting up Match. The following are a list of files you will need to edit:
- ios/fastlane/Appfile - Change to your bundle identifier and Team ID.
- ios/fastlane/MatchFile - Change all the details to your repo and bundle identifier. You will also need to setup a match repo to house your certs/provisioning profiles and go through the process of setting it up.
- android/fastlane/Appfile - Change your application identifier.
You might also want to store metadata for your application in your version control system.
This project is automatically set up to generate screenshots for iOS. To change what screenshots are captured, you need to edit the UI Test in XCode. It can save a huge amount of time if you do this, and you can upload Screenshots automatically as part of your Fastlane delivery process. Android is not supported at this time.
Here is the guide to setting this up. You may want to rename the targets NonaTemplateUITests and NonaTemplateTests and the relevant files in your project.
Also a note on using testID to identify items. This works for TouchableOpacity, but not for Button in React Native.
Sentry is set up with the project, but needs a few more things to be provided for it to work.
- ios/sentry.properties - Change the values in that file to match your team and project.
- Open the project in XCode via the .workspace file. Go to build phases, and edit Upload Debug Symbols To Sentry and uncomment
- Set your Sentry DSN value in
env/common.jsonand re-init your environment with the env command.
For semantic release to work properly using the example CircleCI config you are going to need to run your jobs ideally as a Machine User. That user should have the ability to push new commits on your develop trunk, as it will create a release commit when doing so.
You're also going to need to follow the guide here to create a token that you can set in Circle as an environment variable.