Skip to content

HALLERPierre/react-native-starter-app

 
 

Repository files navigation

GitHub tag GitHub contributors GitHub license GitHub issues GitHub closed issues GitHub pull requests

alt text

React Native Starter Kit

React Native Starter Kit helps you get started with React Native. It contains a bunch of helpful components, building blocks and basic structure to allow you to jump straight into building an app.

What's more, it's now integrated with Firebase, to help you kick start your next full-stack product.

alt text


Docs

  1. Features
  2. Before you start
    1. Getting Started with React Native
    2. React Native Quick Tips
    3. Understanding the File Structure
    4. Opinions Guiding this Project
  3. Using RNSK
    1. Getting Up and Running with RNSK
    2. Renaming the App from StarterKit
    3. Routing / Navigating
    4. Using Google Analytics
    5. Interacting with the Firebase API
    6. Testing
  4. Contributing
  5. Licence

Features

Feature Summary
Redux A predictable state container - Helping you write applications that behave consistently and run in different environments.
React Native Router Flux Router for React Native based on new React Native Navigation API.

'How to' Guide →
Firebase Most apps needs some sort of data. RNSK is setup and ready to go with 'data from the cloud'.
Sidebar / Hamburger Menu ...
React Native Elements Cross Platform React Native UI Toolkit.
Google Analytics Shows how to track screen views (includes both a 'debug' mode tracker as well as 'release' mode so that data doesn't get obfuscated).

Setup Guide →
React Native Vector Icons Easily use icons from a wide range of icon libraries, it's as simple as importing the icon font and then <Icon name={'ios-alert-outline'} size={50} color={"#CCC"} />.
Tcomb Form Validation An example on how to create forms with validation.
Component Style Guide A bunch of elements and components to get you started - styled headings, buttons, list rows, alerts etc.
Code Linting / Code Style Guide We're using Airbnb's JS/React Style Guide with ESLint linting.

Get started with linting for React Native →
Boilerplate An example directory/file structure I've found useful for scaling apps

Learn more →

Getting Started

  1. Ensure you've followed the React Native - Get Started Guide for the platform/s of choice
  2. Clone this project git clone https://github.com/mcnamee/react-native-starter-app.git
  3. Run npm install from root directory
  4. Create your own .env file (to store any app secrets) - simply run cp .env.sample .env
  5. Setup your own Firebase API to get the full experience (optional)
  6. Start the app in an emulator

The API & testing out authentication

We've created a quick little "API server" on Google's Firebase Platform. You can get your own API up and running within minutes too:

  1. Signup for a Firebase account
  2. Create a new project - eg. "React Native Starter App"
  3. Turn on email/password Authentication
  4. Enable the Database feature, and import the firebase-sample-data.json file found in this repo
  5. Get the Firebase project's API credentials, and add them to the respective variables in your /.env file (eg. APIKEY=d8f72k10s39djk29js). You can get your projects details from Firebase, by clicking on the cog icon, next to overview > 'Add Firebase to your web app'.
  6. Add the following rules to the Database
{
  "rules": {
    ".read": false,
    ".write": false,

    "meals": {
      ".read": true
    },

    "recipes": {
      ".read": true,
    	".indexOn": ["category"]
    },

    "users": {
      "$uid": {
        ".read": "auth != null && auth.uid == $uid",
        ".write": "auth != null && auth.uid == $uid",

        "firstName": { ".validate": "newData.isString() && newData.val().length > 0" },
        "lastName": { ".validate": "newData.isString() && newData.val().length > 0" },
        "lastLoggedIn": { ".validate": "newData.val() <= now" },
        "signedUp": { ".validate": "newData.val() <= now" },
        "role": {
          ".validate": "(root.child('users/'+auth.uid+'/role').val() === 'admin' && newData.val() === 'admin') || newData.val() === 'user'"
        }
      }
    },

    "favourites": {
    	"$uid": {
      	".read": "auth != null && auth.uid == $uid",
      	".write": "auth != null && auth.uid == $uid"
    	}
  	}
  }
}

Want to experiment even more with Firebase? Check out the Firebase Cloud Functions


Understanding the File Structure

  • /android - The native Android stuff
  • /ios - The native iOS stuff
  • /src - Contains the full React Native App codebase
    • /components - 'Dumb-components' / presentational. Read More →
    • /constants - App-wide variables and config
    • /containers - 'Smart-components' / the business logic. Read More →
    • /images - Self explanatory right?
    • /lib - Utils, custom libraries, functions
    • /navigation- Routes - wire up the router with any & all screens. Read More →
    • /redux - Redux Reducers & Actions grouped by type. Read More →
    • /theme - Theme specific styles and variables

About

🚀 A React Native boilerplate app to get you up and running very, very quickly 🚀

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 94.3%
  • Objective-C 3.3%
  • Java 1.2%
  • Python 1.2%