@nona-creative/react-native-template

1.0.3 • Public • Published

Nona - React Native Template

React Native Template that can be initialised with the react-native CLI tool.


Features

back to top


Quickstart

Init the project with the following command:

npx react-native init MyApp --template @nona-creative/react-native-template

Read your new project's README.md and docs to get started, and edit if you want to change anything.

The quickest way to run the application:

  • Install ruby gems that the project required from the root with bundle install
  • Run npm run env:development to generate an env file
  • Run npm run start to start your bundler
  • Run npm run ios or npm run android

back to top


Splashscreen Customisation

  • 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.

back to top


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. Mostly they relate to memory settings for the JVM to prevent Android builds running out of memory on CircleCI

back to top


Husky

This project has husky hooks defined 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"

back to top


CircleCI

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 defined as:

echo 'export S3_URL=s3://$ANDROID_KEYSTORE_BUCKET/<< parameters.stage >>/' >> $BASH_ENV

You would need to define that in your environment, and store the keystore in that bucket. You can also see that from template/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 Appstore Connect API key - See here.

Environment variables to change in config.yml and what their purpose:

back to top


Fastlane

Setup Notes

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 Team ID.
  • ios/fastlane/MatchFile - Change all the details to your repo. You will also need to setup a match repo to house your certs/provisioning profiles and go through the process of setting it up.

You might also want to store metadata for your application in your version control system.

Screenshot Generation

This project is automatically set up to generate screenshots for iOS. To change what screenshots are captured, you need to edit the UI Test Defined in XCode (in this template they are at template/ios/NonaTemplateUITests/NonaTemplateUITests.swift, but they will be renamed to your project name on creation). 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, if you want to add more tests/gain greater understanding of the process

A note on using testID to identify items. This works for TouchableOpacity, but not for Button in React Native.

back to top


Sentry

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 #../node_modules/@sentry/cli/bin/sentry-cli upload-dsym
  • Set your Sentry DSN value in env/common.json and re-init your environment with the env command.

back to top


Semantic Release

For semantic release to work using the example CircleCI config you are going to need to run your jobs as a Machine User. That user should have the ability to push new commits on the branch that releases are created on (in the template it's develop), 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, allowing this user to create and push release commits.

back to top

Readme

Keywords

Package Sidebar

Install

npm i @nona-creative/react-native-template

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

4.02 MB

Total Files

210

Last publish

Collaborators

  • yesitsdave
  • syntaxza
  • neilrussell6
  • ian-cawood