This is an example project beside my @webmontagks talk with the topic »React Native - native mobile apps with JavaScript«. (Slides) It uses http://newsapi.org, an API for headlines of several news-sites like BBC, Hacker-News and so on.
These are the prerequisites for React Native. You can read more about the basic setup here: https://facebook.github.io/react-native/docs/getting-started.html#content
$ brew install node
$ brew install watchman
$ npm install -g react-native-cli
Now clone the repo and install all npm dependencies:
$ git clone https://github.com/revrng/wmks-react-native.git
$ cd wmks-react-native && npm install
Make sure you have Xcode installed for the iOS part. Furthermore you need an apple developer account. The good news: you don't need a payed developer account for running the app on your device. Only if you want to publish the app, you need the payed account.
Configuring the API-Key for https://newsapi.org
To use the JSON-API of https://newsapi.org you need to register an api-key (https://newsapi.org/register). Don't worry, it's free.
To use the API-Key inside the project, you need to add the following file:
wmks-react-native/
├── env/
└── apikey.js → It's not under source control (#security)
The file apikey.js
has the following structure:
export default 'PLACE YOUR APIKEY HERE';
$ react-native run-ios
$ react-native run-android