react-native template to target multiple platforms 🌐 πŸ“± πŸ’» with single codebase.
Clone or download
Latest commit 6e2c9d4 Jul 30, 2018

README.md

re-start 🌐 πŸ“± πŸ’»

PRs Welcome

re-start (1).png

Aim of this

  • Target multiple platforms (Android, iOS, Web, Windows[UWP] and Electron[macOS, Ubuntu, Windows]) with react native' APIs and a single codebase.
  • Follow best practices while doing the above.
  • Cut out the time and effort it takes to setup the project (based on create-react-app).
  • Achieve 'Write once use everywhere' with react-native (though react strictly says 'Learn once use anywhere').
  • Mitigate git cloning or manual upgrading of boiler plates, which is possible because this project is a react-native template. πŸŽ‰

Structure of the project:

  • This project comprises of several templates that are curated keeping in mind the various use cases of initiating a new project. Based on your requirements and preferences, you can choose a templates that suits your you case the best.
Template Name Description Installation Command Version
re-base The most basic version that runs on all platforms react-native init <Your Project Name> --template re-base npm version
re-dux re-base with redux wired out of the box react-native init <Your Project Name> --template re-dux npm version
re-route re-base with react-router wired out of the box react-native init <Your Project Name> --template re-route npm version
re-start re-base combined with redux and react-router react-native init <Your Project Name> --template re-start npm version

Usage

Pre-requisites:

Node.js & npm on your system(follow this)
react-native CLI (npm install -g react-native-cli)

All you have to do is:

  • Create a new react-native project using react-native-cli and specify this project as a template:
react-native init <Your Project Name> --template <Template Name>
  • Since react-native-template doesn't support adding dev dependencies and custom scripts to package.json, so I have created a custom script to do that.
node scripts/additionalDependencies.js

Notes:

  • If the above script fails due to some reason, you can do it manually by copying the contents of devDependencies.json to your package.json's devDependencies object and adding following to the scripts object.
"web": "react-scripts start",
"build": "react-scripts build"
  • make sure that the version of react-native-windows is same as your react-native version, if you are targeting windows support.

Run the project on a specific platform:

Android

react-native run-android

iOS

react-native run-ios

Web

npm/yarn run web

Windows

react-native windows react-native run-windows

Desktop (Electron)

npm/yarn run electron

Build for production:

Android/iOS

This will help

Web

npm/yarn run build (this will build your production ready bundle)


Some very useful cross platform compatible libraries:


Progress:

  • support for web (react-native-web)
  • support for Windows (react-native-windows)
  • Support for electron
  • Compatibility with React 16
  • Add Docs and FAQs
  • Configure Travis and Greenkeeper
  • Interactive CLI to create templates and components

Running demo on Web, Android, iOS, Windows(Universal) and Electron:


Contributors

Thanks goes to these wonderful people (emoji key):


Amogh Banta

πŸ’» 🎨 πŸ“– πŸ› πŸ€” ⚠️

JesΓΊs LeganΓ©s-Combarro

πŸ’» πŸ€” πŸ› ⚠️ πŸ‘€ πŸ“–

Ankit Popli

πŸ‘€ πŸ€” πŸ›

Christopher Hein

πŸ“– πŸ›

DuncanMacWeb

πŸ’»

Full list of contributors can be found here.

Companies that contribute to re-start's development:

LICENSE

MIT