π Start UI [native] is a opinionated React Native starter repository created & maintained by the BearStudio Team and other contributors. It represents our team's up-to-date stack that we use when creating React Native apps for our clients.
npx create-start-ui --native myApp
That will scaffold a new folder with the latest version of π Start UI [native] π
Then just go to the created folder cd myApp
and follow the Installation Guide.
- βοΈ React Native
- βοΈ React Navigation
- β¬’ Native Base 3
- βοΈ React Query
- π Formiz
- β Axios
- πΊ Mirage JS
βΉοΈ API calls are mapped on a jHipster backend application.
βΉοΈ The project is started with a Mirage JS server API, that allows to mock the calls in local. Like this, you don't need your API to be ready to start development on your mobile application.
- Install project dependencies
yarn install
-
Set up your local environment config
- Copy the
environments/dev/config.js
in theenvironments/local
folder - Replace the
ENV: ENVS.DEV,
line withENV: ENVS.LOCAL,
within theenvironments/local/config.js
file. - Run the
yarn set:env:local
command.
- Copy the
-
Then follow the Android Installation Guide or iOS Installation Guide.
- Follow the "Installing dependencies" of React Native CLI Quickstart for Android
- Run the development server
yarn dev
- In another terminal
yarn android
The first time you will release your app, you will need to generate a keystore
./scripts/generate-android-certificate.sh
And then, follow the instructions.
Then, you need to update the RELEASE_KEY_STORE_PASSWORD
and RELEASE_KEY_PASSWORD
into the android/gradle.properties
file.
You should not keep this in the git history. Use a password manager or other secured solution to keep this file.
β οΈ DO NOT LOOSE IT. YOU WILL NOT BE ABLE TO RELEASE YOUR APP.
We are using Android App Bundle on this project. This is a new and more efficient way to package an Android application.
Based on the environment that you need to target run one of the following command:
yarn android:bundle:dev
# or
yarn android:bundle:staging
# or
yarn android:bundle:prod
The Bundle file will be available at android/app/build/outputs/bundle/release/app.aab
β οΈ You can test the release application with the APK version (next section) on your device before uploading the bundle file on the Play Store (Especially for production release).
If you want to generate the release APK for testing the release configuration on your device before sending the bundle to the PlayStore, you can use one of the following commands based on the target environment:
yarn android:build:dev
# or
yarn android:build:staging
# or
yarn android:build:prod
The APK will be available at android/app/build/outputs/apk/release/app-release.apk
and will be installed on your connected device.
For iOS development you need to be on a Apple computer with macOS.
- Follow the "Installing dependencies" of React Native CLI Quickstart for iOS
For Apple chips (M1) also run the following command
sudo arch -x86_64 gem install ffi
- Install pods
Processor type | Command line |
---|---|
Intel chip | yarn ios:install:intel |
Apple chip (M1) | yarn ios:install:arm |
- Run the development server
yarn dev
- In another terminal
yarn ios:open
This will open the project in Xcode.
- Click on the "Play" button on Xcode.
- Setup your targeted environment
yarn set:env:dev
# or
yarn set:env:staging
# or
yarn set:env:prod
- Open Xcode
yarn ios:open
- Follow the Publishing to Apple App Store documentation.
With the evolutions on the project, if you need to update Info.plist
, please update all Info.plist
in all ios
subfolders.
Environments variables are managed thanks to the subfolders in the environments
folder:
- local: Your local environment, when developing on your computer
- dev: For your app internal testing
- staging: For your app alpha/beta/testflight testing
- production: For your production app release on the stores
This approche allows us to have dependent environment files, like Firebase configurations (google-services.json and GoogleService-Info.plist), that will be copied when you'll release, which is not possible with react-native-dotenv for instance.
You can switch environment with one of the following commands:
yarn set:env:local
# or
yarn set:env:dev
# or
yarn set:env:staging
# or
yarn set:env:prod
We provide some devtools that can be accessed from the dev menu.
You can open it by typing d on the yarn dev
console.
You will find the following tools:
- Storybook
- Network helper
When you need to update the application name and to remove "Start UI Native" references, please use this library:
npx react-native-rename "My Amazing App"
You can use Launcher icon generator online tool to generate the icon files for Android:
Download and extract the .zip file it into android/app/src/main/res/
folder.
For iOS, you can use Icon Set Creator for MacOS.
https://appicon.co/ online tool.
And then, import these images into a new image assets into xcode. You can follow this tutorial for example.