Skip to content

๐Ÿš€ A boilerplate to quickly setup a React Native project with Redux, Router, NativeBase, Icons and ESLint

Notifications You must be signed in to change notification settings

Michaelvilleneuve/react-native-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

28 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

REACT NATIVE BOILERPLATE

Because I couldn't find any correct and lightweight boilerplate to start with React Native, I decided to build a minimal app that contains all the required libraries to correctly start a project.


Libraries

Default Components and code

This boilerplate really provides the minimum setup. The src folder contains all the actual code. For the purpose of the example, and because most app will need it, I left a login form so you can understand the code and keep the architecture.

How do I launch the project ?

  1. npm install
  2. npm install -G react-native-rename
  3. react-native-rename yournewname
  4. react-native link
  5. Either run ๐Ÿ‘‰ react-native run-ios
  6. Or ๐Ÿ‘‰ react-native run-android

How do I start coding ?

Well, if you need a login form, you can basically start adding your own components into src/components, and plug them to the src/Router.

If not, you can trash src/actions/AuthActions, src/reducers/AuthReducer, src/components/LoginForm, and the references to theses files in src/actions/index, src/actions/types, src/components/Router, src/components/reducers/index.

If you don't now how to organize redux actions/reducers, have a look at how it works for the form before trashing anything.

In general, your programming flow will be the following :

  • Add a scene in src/Router and link it to a new component
  • Create the component in src/components
  • Write the component JSX code
  • Import redux in your new component
import { connect } from 'react-redux';
  • Map global state to access it as props
const mapStateToProps = ({ theKeyOfTheAction }) => {
  // theKeyOfTheAction can be any key defined in reducers/index
  const { yourProps, blaBlaProps } = theKeyOfTheAction;

  return { yourProps, blaBlaProps };
};

export default connect(mapStateToProps, { yourActions, blaBla })(LoginForm);
  • Create your actions in src/actions
  • Reference them in src/actions/types
  • Pass back your new state from src/reducers if needed

About

๐Ÿš€ A boilerplate to quickly setup a React Native project with Redux, Router, NativeBase, Icons and ESLint

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published