Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/natura-cosmeticos/react-native-start

Boilerplate of main modules for React Native
https://github.com/natura-cosmeticos/react-native-start

Last synced: about 5 hours ago
JSON representation

Boilerplate of main modules for React Native

Awesome Lists containing this project

README

        

# React Native Start

[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/a5db3937935a42b0941411f9750152ca)](https://www.codacy.com/manual/douglasofreitas/react-native-start_2?utm_source=github.com&utm_medium=referral&utm_content=natura-cosmeticos/react-native-start&utm_campaign=Badge_Coverage)
[![Build status](https://build.appcenter.ms/v0.1/apps/fa1d2c09-f10c-4f58-9733-e231fa9a8218/branches/dev/badge)](https://appcenter.ms)
[![Build status](https://build.appcenter.ms/v0.1/apps/187dde4d-1402-48ee-947f-686ae36c4c85/branches/dev/badge)](https://appcenter.ms)

Boilerplate of react-native app with usefull libraries.

Project with:

* Node: "10.16.3" (Dynatrace/react-native-plugin not suport 12 yet)
* React: "16.8.3"
* React Native: "0.59.9"

To use demo version, use the API above to test login (Auth):
https://github.com/douglasofreitas/node-jwt-authentication-api

Use:
* Hooks

Libraries:
* @dynatrace/react-native-plugin
* @react-native-community/async-storage
* react-navigation
* react-native-config
* react-native-firebase
* react-native-code-push
* react-native-device-info
* react-native-i18n
* react-native-cached-images
* react-native-camera
* react-native-video
* react-native-webview
* react-native-maps
* react-native-elements
* axios
* jetifier
* prop-types
* jest-enzyme
* eslint
* test (jest)
* codacy-coverage

Pending samples:
* upload files progress
* get current position (navigation.geolocation)
* use Design System

## Prepare Enviroment Variables

App Center build de .env file using script "appcenter-pre-build.sh"
The ".env.sample" file is a sample of ".env" generate by APP Center and is used to run local.
Create the ".env" file and fill parameters.

Create accounts:

* Create the files on [Firebase console](https://console.firebase.google.com) and put the files in DATA folder
* Create Google Maps Key in [GCP](https://console.cloud.google.com) and put de Key at .env file.

This version has Dynatrace Integration. If you don't need this, remove the module "@dynatrace/react-native-plugin".

```
// Optional to remove Dynatrace
npm uninstall --save @dynatrace/react-native-plugin
react-native unlink @dynatrace/react-native-plugin
```

Create the folder "DATA" next to the project folder:

```
- react-native-start (project folder)
- src
- android
- ios
- ...
- DATA
_ certificates
- ios
- .p12 and .mobileprovision certificates
- android
- .keystore file
- dev (ENV: environment folder)
- google-services.json
- GoogleService-Info.plist
- master
...
```

## Run app

Install Dependences
```
yarn install
cd ios && pod install
```

After prepare DATA folder, run code to prepare the project
```
./local-load-config-env.sh

//Dynatrace Instrumentation
npm run instrumentDynatrace
```

Finally, run the application:
```
npm run android
npm run ios
```

Before commit your changes, run code below to reset Local configurations
```
./local-hide-config-env.sh
```
Or commit only your changes

## BUILD with AppCenter

To use [AppCenter](https://appcenter.ms), there are configuration:

* Pre-build (appcenter-pre-build.sh)

To use the script, create the environment variables as:
* RN_: create .env file with variables with RN_ at the beginning of the name
* GOOGLE_CONFIG_ANDROID = base64 of google-services.json
* GOOGLE_CONFIG_IOS = base64 of GoogleService-Info.plist
* GOOGLE_MAPS_KEY = Google Maps Key from GCP
* CODEPUSH_KEY = Key of Appcenter Codepush
* CODACY_PROJECT_TOKEN = Key of Codacy to sync test
* DYNATRACE_APP_ID = Get from Dynatrace account
* DYNATRACE_IOS_ENVIRONMENT = Get from Dynatrace account
* DYNATRACE_IOS_CLUSTER_URL = Get from Dynatrace account
* DYNATRACE_ANDROID_BEACON_URL = Get from Dynatrace account

Example of environment in AppCenter backoffice
RN_=value

Example of final .ENV file:
=value

## Run tests

```
npm run test
npm run coverage
npm run coverage:codacy -- --token //to send report to Codacy
```

## Rename Project to your GOAL

Use the packege to rename your project name and bundle:
https://www.npmjs.com/package/react-native-rename