Basic mobile WebView wrapper for Trustroots.org
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
assets
.babelrc
.editorconfig
.eslintrc.json
.gitignore
.travis.yml
.watchmanconfig
App.js
CHANGELOG.md
LICENSE
README.md
Settings-example.js
app.json
package-lock.json
package.json

README.md

Trustroots Mobile App

Trustroots.org mobile app built with Expo.io and React Native.

Install for Android via Play Store or download APK.

Currently the app merely wraps Trustroots.org site in a WebView component.

Getting started with development

Before you start

  1. You need NPM and Node. Install them. Currently it's recommended to use NPM v3 or v4, because there are still some defects in NPM v5.
  2. Run npm install in project directory
  3. Create settings file: cp Settings-example.js Settings.js (and modify contents if needed)

Running the app on physical phone

  1. Get an Expo account. You register from Expo web site or by using command line utility.
  2. Install Expo App to your mobile phone:

You have two options for deploying, graphical or command line. Expo XDE might be easier path to get everything up and running.

Using Expo XDE graphical app

  1. Install Expo XDE to your development machine (supports Windows/OSX/Linux).
  2. Open App in Expo XDE. It should start compiling it.
  3. Connect your mobile phone to development server. In XDE there is share button when you click it you should see QR code you can scan with Expo App. Command line utility prints QR code to console.

Using exp commandline utility

  1. Install exp npm install -g exp
  2. In project directory:
    • If your phone is connected via cable: exp start --android --tunnel
    • If your phone is connected to same network as your computer exp start --android --lan
  3. Open mobile app and scan QR code

Running in emulator

If you prefer emulator instead of using physical phone check out instructions form Expo site.

Note that emulator cannot process push notifications.

Running local development version of the site inside the app

By default app is configured to load site from https://www.trustroots.org in the WebView, but you can change this to load your local version.

Before you start, install and run Trustroots on your local machine.

To load your local version:

  1. You should have Trustroots website running at http://localhost:3000.
  2. Find your computer's private network IP. You can verify it by loading http://YOUR-IP-ADDRESS:3000/ in your browser.
  3. Open Settings.js and set BASE_URL to http://YOUR-IP-ADDRESS:3000/.
  4. Done! You should now see the page refresh on your phone or emulator if you change any files at the website.

Note that if you want to use https or different port, you need to configure those from Trustroots's configuration files.

Writing code

Lint your code using npm run lint (or npm test).

You can see exact validation rules from expo:eslint-config-universe, or just try to follow surrounding code. You could also install Eslint integration in your editor. See also Editorconfig for your editor.

Debugging

License

MIT