This React Native app is meant to be used for several workshops. It is a small, but fully functional app, that displays the availabilities of parkings in the center of the city of Ghent.
This app currently supports 2 ways to fetch that data:
- A static way, via the
data/parkings.json
file - A dynamic way, by using Firebase as a proxy
The data itself is made available by the city of Ghent, licensed under the terms of the Modellicentie Gratis Hergebruik: https://datatank.stad.gent/4/mobiliteit/bezettingparkingsrealtime
- node.js 8
- yarn
- Run
yarn install
. - Test the app (via the Expo app):
yarn start
. (Or use a simulator, by runningyarn run ios
oryarn run android
).
This project uses Jest to perform unit testing. Tests
can be executed by issuing yarn test
.
ESLint is used for static code analysis. Eslint nicely integrates
with editors as Atom or Visual Studio Code. Running the linter manually can be done
by issuing yarn run lint
.
Continuous integration, including static code analysis and automated unit testing, can be setup using Travis CI. Simply sign-in with your Github account and enable builds for your forked Github repository.
The Firebase setup actually uses 2 components:
- The app will read the database and reflect any changes in real-time.
- A node.js script (
scripts/pushDataToFirebase.js
) will publish new data to Firebase every 10s.
In order to use the application with Firebase, please follow these steps:
- Create a new Firebase project
- Create a new Realtime Database
- In the
rules
tab, specify these rules:This will make the database readable for anyone that has access to it, but requires users to be authenticated in order to write.{ "rules": { ".read": true, ".write": "auth != null" } }
- Go to Authentication and add a user with the following credentials:
- email:
[email protected]
- password:
firebase
This account will be used by the import script to authenticate itself.
- email:
- Now go to Project Settings and select the option to add a webapp to Firebase. Copy these settings over to the
config/firebase.json
file. - Run
yarn run firebase
. This command will execute the import script (located atscripts/pushDataToFirebase
). - If that succeeds, start the app by simply running
yarn start
Tip: To test and see real-time updates, stop the script and simply adjust values in the Firebase database.
This application is licensed under the term of the MIT license.