Skip to content

mobolun/integreat-react-native-app

 
 

Repository files navigation

versioning: versioning

integreat-react-native-app

Setup

  • Clone the repository
  • Install Android Studio and try to setup a test project
  • If you plan to use an Emulator try to run it with the test project and make sure it works
  • Open the project with an IDE of your choice
  • Run yarn

Running the App for development

  • Run yarn start to start the bundler

Android

  • Run your Android Emulator or connect a device
  • Run yarn android

iOS

  • Update CocoaPods
  • Run yarn ios

If you encounter problems:

ERROR watch... ENOSPC when running yarn start on Linux

Increase the number of inotify watches by running
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

adb not found

There are 2 ways to fix this:

  1. Link /usr/bin/adb to the adb client you installed (usually the one at ~/Android/sdk/platform-tools/adb)
  2. Add ~/Android/sdk/platform-tools/adb to your $PATH

'adb server version (x) doesn't match this client (y)'

Make sure you only have one version of adb installed. Probably your system has one and Android Studio installed a second one. There are 2 ways to fix this:

  1. Link /usr/bin/adb to the adb client you installed (usually the one at ~/Android/sdk/platform-tools/adb)
  2. Add ~/Android/sdk/platform-tools/adb to your $PATH

adb shows no-permission

Setup udev rules to allow user accounts to access your phone.

Conventions

For naming we follow the airbnb style. For the JavasScript code style we use the standard style. For git commit messages this style.

Versioning

versioning with:

  • YYYY - Full year - 2006, 2016
  • MM - Short month - 1, 2 ... 11, 12
  • Minor - The third number in the version. For feature and bugfix releases.

Folder structure

├── __mocks__
├── modules
│   └── app
│       ├── constants
│       ├── assets
│       ├── components
│       ├── containers
│       ├── actions
│       ├── hocs
│       └── reducers
└── routes
    └── route-name
│       ├── assets
│       ├── components
│       ├── containers
│       │   └── RouteNamePage.js
│       ├── actions
│       ├── hocs
│       └── reducers

A component always follows the following structure (Uppercase files always contain a single class):

├── __tests__
│   └── Caption.js
└── Caption.js

Technology stack

Bundler

Webpack is used to compile and bundle the app.

Frontend framework

React is used as frontend framework. This allows us to build a single-page-application easily.

JavaScript compiler

Babel is used to make the app available to a broader audience while allowing the developers to use many new language features. We use flow for type safety.

Application state

Redux is used for the global application state. The data which is received through the restful api of the CMS is "cached" and stored in this state container.

Testing

  • Jest is used for testing.
  • is used for testing cross-platform compatibility

Debugging

For debugging install react-native-debugger

Enter the development menu

Shake the device or press Ctrl+M to enter the menu. If you are connected though adb to your android device you can also run: adb shell input keyevent 82

Reload the app

You can enter the development menu and click "Reload" or use adb: adb shell input text "RR"

Steps to get started with debugging:

  • Start react-native-debugger
  • Start the metro bundler
  • Connect a real device or run an emulator though adb (e.g. $ANDROID_HOME/emulator/emulator -avd <avd>)
  • Setup network connectivity from the emulator/device to the host where the bundler is running (see here)
  • Enter the development menu and enable "Remote JS Debugging"
  • The app should reload now and the debugger should connect to the device

Setup connectivity from device to metro

On Android you have 2 options:

  • Setup a tunnel though adb: adb reverse tcp:8081 tcp:8081
  • Open the development options of the react-native app (shake device or Ctrl+M) and set a development host

On iOS the post 8081 is tunneled by default. You can not change this. If the emulator is running on an other host you can proxy the port with yarn run proxy <host>

Linting

  • The linter for JavaScript is eslint

You can run the linter by calling yarn run lint. Some issues can be fixed automatically by running yarn run lint:fix

Type checking

Flow is used for static type checking.

Go to Settings > Languages & Frameworks > JavaScript and

  • choose Flow as Language version
  • set Flow package or executable to <project_dir>/node_modules/flow-bin

You can run flow using yarn flow.

IDE

Make sure you have at least nodejs 6 installed

We suggest IntellJ IDEA Ultimate as IDE. Just import this project (from existing sources). Run yarn in Terminal and right-click on package.json to show the npm scripts.

Install the following plugins:

  • ESLint
  • Styled Components

If you want you can associate the *.snap files with the file type JavaScript.

Issue Tracker

You can view our issues or create new ones on our jira.

About

Mockup for a react native client for integreat

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 94.6%
  • Objective-C 2.1%
  • Other 3.3%