Skip to content

Latest commit

 

History

History
155 lines (120 loc) · 4.07 KB

README.md

File metadata and controls

155 lines (120 loc) · 4.07 KB

React Native Start

Codacy Badge Build status Build status

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 and put the files in DATA folder
  • Create Google Maps Key in GCP 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, there are configuration:

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

To use the script, create the environment variables as:

  • RN_<VAR_NAME>: 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_<VAR_NAME>=value

Example of final .ENV file: <VAR_NAME>=value

Run tests

npm run test
npm run coverage
npm run coverage:codacy -- --token <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