react-native/local-cli/templates/HelloNavigation
alejandro garcia 224d29447f Fixed navigation template
Summary:
- [x] Explain the **motivation** for making this change.

It fixes #14313
Closes https://github.com/facebook/react-native/pull/14495

Differential Revision: D6042094

Pulled By: hramos

fbshipit-source-id: d70e42bfee0a22882bad91cb885fb0cfc91c7d38
2017-10-12 11:44:20 -07:00
..
components Remove unused variable in HelloNavigation example 2017-10-11 07:07:21 -07:00
lib CLI: Add README to app template, lint 2017-02-07 10:32:29 -08:00
views Fixed navigation template 2017-10-12 11:44:20 -07:00
App.js Fixed navigation template 2017-10-12 11:44:20 -07:00
README.md Fixed navigation template 2017-10-12 11:44:20 -07:00
dependencies.json Fixed navigation template 2017-10-12 11:44:20 -07:00

README.md

App template for new React Native apps

This is a simple React Native app template which demonstrates a few basics concepts such as navigation between a few screens, FlatLists, and handling text input.

Android Example iOS Example

Purpose

The idea is to make it easier for people to get started with React Native. Currently react-native init creates a very simple app that contains one screen with static text. Everyone new to React Native then needs to figure out how to do very basic things such as:

  • Rendering a list of items fetched from a server
  • Navigating between screens
  • Handling text input and the software keyboard

This app serves as a template used by react-native init so it is easier for anyone to get up and running quickly by having an app with a few screens and a FlatList ready to go.

Best practices

Another purpose of this app is to define best practices such as the folder structure of a standalone React Native app and naming conventions.

Not using Redux

This template intentionally doesn't use Redux. After discussing with a few people who have experience using Redux we concluded that adding Redux to this app targeted at beginners would make the code more confusing, and wouldn't clearly show the benefits of Redux (because the app is too small). There are already a few concepts to grasp - the React component lifecycle, rendering lists, using async / await, handling the software keyboard. We thought that's the maximum amount of things to learn at once. It's better for everyone to see patterns in their codebase as the app grows and decide for themselves whether and when they need Redux. See also the post You Might Not Need Redux by Dan Abramov.

Not using Flow (for now)

Many people are new to React Native, some are new to ES6 and most people will be new to Flow. Therefore we didn't want to introduce all these concepts all at once in a single codebase. However, it might make sense to later introduce a separate version of this template that uses Flow annotations.

Provide feedback

We need your feedback. Do you have a lot of experience building React Native apps? If so, please carefully read the code of the template and if you think something should be done differently, use issues in the repo mkonicek/AppTemplateFeedback to discuss what should be done differently.

How to use the template

$ react-native init MyApp --template navigation
$ cd MyApp
$ react-native run-android
$ react-native run-ios