These are things you need to have to run code on either iOS or Android.
- react-native-cli
npm install -g react-native-cli
# server side dependencies
npm install
# client side dependencies
cd client/zestyreactnative && npm installInstall MariaDB. When installing, set both your username and your password to 'root'
Start up mysql server and then create the database:
$ mysql.server start
$ mysql -u root -p
MariaDB [(none)]> create database zestydb;
MariaDB [(none)]> use zestydb;
MariaDB [(none)]> exit;
The idea is to write one code base for Android & iOS devices. Setup for both platforms is similar and this guide will walk you through both.
- watchman (helpful for hot reloading)
- installation will be specific to your computer's operating system
- Android Studio
- Gradle (optional, but can speed up build times)
- XCode
It may be helpful to have one terminal tab open per process
- run the (node) server from the root directory of this project
npm startif IOS onlymyLocalIP=123.45.678.90 npm startif running Android
- run the react native packager server from
client/zestyreactnative
react-native run-iosAND/ORreact-native run-android
- run the client packager server from
client/zestyreactnative
npm start
- run the emulator or connect a device to your computer
If you are not writing for Android, then skip down to the iOS section.
Something to note, if you are developing for Android you will have to manually set the authentication endpoints with the local IP address of your computer.
An Android emulator has its own IP address. So if the client code sees an
address with localhost, it will think to look for a port on its own device
instead of an endpoint on your local Node server. Credit
ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'Or if you have a Mac, you can try this:
Once you have this number, export it from the file:
client/zestyreactnative/src/helpers/scaffolding.js
module.exports.myLocalIp = '123.45.678.90';To get the authentication working for Android development, you must also modify the callback URL on your GitHub profile.
Register a new application, include the local IP into your callback URL. If you need help, please ask a Zesty Stocking team member.
myLocalIp=123.45.678.90 npm startcd client/zestyreactnative
react-native run-androidnpm startcd client/zestyreactnative
react-native run-iosTo configure production on Heroku, follow these instructions. Don't forget to set the following environment variables using 'heroku config':
GITHUB_CLIENT_ID
GITHUB_CLIENT_SECRET
JAWSDB_MARIA_URL (this one should be set automatically after you [provision a MariaDB database](https://devcenter.heroku.com/articles/jawsdb-maria) on Heroku)
Also, be sure to modify the file:
client/zestyreactnative/src/helpers/scaffolding by following the instructions
in the last section.
To deploy to production, run
$ git push heroku master
$ heroku open