|
2 | 2 |
|
3 | 3 |  [](https://codeclimate.com/github/AmitM30/react-native-typescript-boilerplate)  [](./CONTRIBUTING.md)
|
4 | 4 |
|
5 |
| -### An opinionated [React Native](https://facebook.github.io/react-native/docs/getting-started) Starter Kit with [React Native Navigation](https://github.com/wix/react-native-navigation) + [Redux](https://github.com/reactjs/redux) + [Airbnb TSLint](https://github.com/airbnb/javascript) to build iOS and Android apps using [TypeScript](https://github.com/Microsoft/TypeScript-React-Native-Starter) |
| 5 | +#### An opinionated [React Native](https://facebook.github.io/react-native/docs/getting-started) Starter Kit with [React Native Navigation](https://github.com/wix/react-native-navigation) + [Redux](https://github.com/reactjs/redux) + [Airbnb TSLint](https://github.com/airbnb/javascript) to build iOS and Android apps using [TypeScript](https://github.com/Microsoft/TypeScript-React-Native-Starter) |
| 6 | + |
| 7 | +___ |
6 | 8 |
|
7 | 9 | The project has been setup based off [RN Getting Started](https://facebook.github.io/react-native/docs/getting-started) and instructions from [Microsoft's Github TypeScript React Native Starter](https://github.com/Microsoft/TypeScript-React-Native-Starter) repo.
|
8 | 10 |
|
9 | 11 | ### Supports React Native 0.63.3, React Native Navigation v7 and Flipper
|
10 | 12 |
|
11 |
| -This repo supports the latest version of React Native compatible with React Native Navigation. |
12 |
| - |
13 |
| -| UPDATE | RNN | RN | React | Comments | |
| 13 | +| | RNN | RN | React | Comments | |
14 | 14 | |---|---|---|---|---|
|
15 |
| -| 7th October '20 | 7.1.0 | 0.63.3 | 16.13.1 | Major Upgrade, Support for Flipper |
16 |
| -| 27th April '20 | 3.7.0 | 0.61.5 | 16.9.0 | Support for RN > 0.60 |
17 |
| -| 2nd Nov '19 | 2.26.2 | 0.59.10 | | Maintenance | |
18 |
| -| 30th April '19 | 2.18.3 | 0.59.5 | 16.8.6 | Maintenance | |
19 |
| -| 8th March '19 | 2.13.1 | 0.58.6 | 16.8.4 | |
20 |
| - |
21 |
| -### Who is this for? |
22 |
| - |
23 |
| -Jumpstart building robust apps using React Native, with TypeScript. The base setup has been taken care of, just `yarn install` and get going from respective IDEs. |
24 |
| - |
25 |
| -You might also want to [rename](https://medium.com/the-react-native-log/how-to-rename-a-react-native-app-dafd92161c35) the app for your own use. |
| 15 | +| 07 Oct '20 | 7.1.0 | 0.63.3 | 16.13.1 | Support for Flipper |
| 16 | +| 27 Apr '20 | 3.7.0 | 0.61.5 | 16.9.0 | Support for RN > 0.60, Android X |
| 17 | +| 02 Nov '19 | 2.26.2 | 0.59.10 | | Maintenance | |
| 18 | +| 08 Mar '19 | 2.13.1 | 0.58.6 | 16.8.4 | |
| 19 | + |
| 20 | +## Introduction |
| 21 | + |
| 22 | +Jumpstart building robust apps using React Native and TypeScript with most commoly needed tools already setup. Just `yarn install` and get going from respective IDEs. |
| 23 | + |
| 24 | +- Routing and Navigation |
| 25 | + - Tabbed navigation using [React Native Navigation v7](https://github.com/wix/react-native-navigation) |
| 26 | + - Side Menu support |
| 27 | +- State Management using Flux Architecture |
| 28 | + - [Redux](https://redux.js.org/introduction/getting-started) |
| 29 | + - [Redux-Thunk](https://github.com/reduxjs/redux-thunk) middleware |
| 30 | +- Widgets / Elements |
| 31 | + |
| 32 | + Build your own design system with these building blocks. |
| 33 | + - **elements**: `<BUTTON_DEFAULT>` or `<CText>`. They are custom elements that have default properties like font, size and so on. |
| 34 | + - **widgets**: Any component providing a complete functionality. E.g. carousels component, banner component, etc. |
| 35 | +- Typography |
| 36 | + - Base Typography setup - Color, Font, LAYOUT, CTA, FONTS, TEXT, TEXT_INPUT |
| 37 | +- Code Lint |
| 38 | + - [Airbnb's JS](https://github.com/airbnb/javascript) Linting |
26 | 39 |
|
27 | 40 | > _Disclaimer_: This is an **opinionated** approach to building apps with RN. The project structure is inspired by multiple production apps built by the contributors.
|
28 | 41 |
|
29 |
| -#### App Screens |
| 42 | +##### App Screens |
30 | 43 |
|
31 | 44 | |  |  | |
|
32 | 45 | | :-------------------------------------------------------: | :---------------------------------------------------: | :---------------------------------------------------: |
|
33 | 46 |
|
34 |
| -#### Flipper Support |
| 47 | +##### Flipper Support |
35 | 48 |
|
36 | 49 | 
|
37 | 50 |
|
38 | 51 | ### Table of Contents
|
39 | 52 |
|
40 | 53 | - [Project Structure](#project-structure)
|
41 |
| -- [Running](#running) |
42 |
| -- [Lint](#lint) |
43 |
| -- [Unit Tests](#unit-tests) |
| 54 | +- [Getting Started](#getting-started) |
44 | 55 | - [Cheat Sheet](#cheat-sheet)
|
45 | 56 | - [Single Screen vs Tabbed Based Navigation](#single-screen-vs-tabbed-based-navigation)
|
46 |
| - - [Styles](#styles) |
47 |
| - - [Widgets / Elements](#widgets---elements) |
| 57 | + - [Renaming the App](#renaming-the-app) |
48 | 58 | - [Contributing](#contributing)
|
49 | 59 | - [TODO](#todo)
|
50 | 60 |
|
51 |
| -#### Project Structure |
| 61 | +### Project Structure |
52 | 62 |
|
53 | 63 | ```
|
54 | 64 | /
|
@@ -90,95 +100,75 @@ You might also want to [rename](https://medium.com/the-react-native-log/how-to-r
|
90 | 100 | ```
|
91 | 101 |
|
92 | 102 | `shared`
|
93 |
| -Everything related to application business logic (store) resides under this directory. |
| 103 | +Everything related to application business logic. The redux store. |
94 | 104 |
|
95 | 105 | `src`
|
96 |
| -Only presentation layer for the app, styles, images, icons are meant to be under this. |
97 |
| - |
98 |
| -#### Running |
| 106 | +Presentation layer for the app - screens, styles, images, icons etc. |
99 | 107 |
|
100 |
| -Make sure node version installed is `>=10.x.x` |
| 108 | +### Getting Started |
101 | 109 |
|
| 110 | +Make sure node version installed is `>=10.x.x`. Then install using yarn (or npm): |
102 | 111 | ```
|
103 | 112 | yarn install
|
104 | 113 | ```
|
105 | 114 |
|
106 |
| -#### Launch |
107 |
| - |
108 |
| -###### iOS |
109 |
| - |
110 |
| -``` |
111 |
| -cd ios && pod install |
112 |
| -``` |
113 |
| - |
114 |
| -Launch application from XCode |
115 |
| - |
116 |
| -###### Android |
117 |
| - |
118 |
| -For android, run the Metro Bundler from the terminal |
119 |
| - |
| 115 | +Start the Metro Bundler: |
120 | 116 | ```
|
121 |
| -npm run start |
| 117 | +yarn start |
122 | 118 | ```
|
123 | 119 |
|
124 |
| -and then launch from IDE. |
125 |
| - |
126 |
| -#### Lint |
| 120 | +###### iOS |
127 | 121 |
|
128 |
| -To run lint on the application: |
| 122 | +One time. Move to `ios` folder and install pods: |
129 | 123 |
|
130 | 124 | ```
|
131 |
| -yarn lint |
| 125 | +cd ios && pod install |
132 | 126 | ```
|
133 | 127 |
|
134 |
| -Fixes most tslint issues automatically: |
| 128 | +Launch application from XCode (`Command + R`) Or launch from Terminal: |
135 | 129 |
|
136 | 130 | ```
|
137 |
| -yarn lint:fix |
| 131 | +yarn ios |
| 132 | +# runs the following command. change device name here |
| 133 | +# `npx react-native run-ios --simulator='iPhone 11'` |
138 | 134 | ```
|
139 | 135 |
|
140 |
| -#### Unit Test |
141 |
| - |
142 |
| -Unit tests are under `__test__` directory at root. |
143 |
| - |
144 |
| -To run unit test on the application: |
| 136 | +###### Android |
145 | 137 |
|
| 138 | +Start an Android Simulator from: |
146 | 139 | ```
|
147 |
| -npm run test |
| 140 | +Android Studio > Tools > AVD Manager > Run any device |
148 | 141 | ```
|
149 | 142 |
|
150 |
| -To find unit test coverage for the application: |
151 |
| - |
| 143 | +Similarly, run from Android Studio itself Or from Terminal: |
152 | 144 | ```
|
153 |
| -npm run test:coverage |
| 145 | +yarn android |
| 146 | +# runs the following command |
| 147 | +# react-native run-android --variant=Debug |
154 | 148 | ```
|
155 | 149 |
|
156 |
| -#### Cheat Sheet |
| 150 | +### Cheat Sheet |
157 | 151 |
|
158 |
| -##### Single Screen vs Tabbed Based Navigation |
| 152 | +#### Single Screen vs Tabbed Based Navigation |
159 | 153 |
|
160 | 154 | The application launches with a splash screen, and then moves to a tabbed based navigation. Splash screen is a good place to fetch data / build application launch logic like getting user token from API or Async Store, load persist state etc.
|
161 | 155 |
|
162 | 156 | For Single screen application, replace this tabbed based navigation with a single screen - just `home`, or simply use the splash screen to setup the app, may be with a burger menu.
|
163 | 157 |
|
164 |
| -##### Styles |
165 |
| - |
166 |
| -The `styles` folder contains `global` style and `typography` for the application. Styles for each screen has been placed with the screen, as they are used together with the screen, unlike web. |
167 |
| - |
168 |
| -##### Widgets / Elements |
| 158 | +#### Renaming the App |
169 | 159 |
|
170 |
| -The custom components have been broken into 2 major categories, namely - **widgets**, **elements** |
| 160 | +You might also want to rename the app for your own use. Follow any of the links below. |
| 161 | +- [How to Rename A React Native App](https://medium.com/the-react-native-log/how-to-rename-a-react-native-app-dafd92161c35) |
171 | 162 |
|
172 |
| -A Good use case would be: |
| 163 | +Or |
173 | 164 |
|
174 |
| -- **widgets**: Any component providing a complete functionality. Like carousels component, banner component, etc. |
175 |
| -- **elements**: Smallest building blocks of application. A custom element, may be `<ButtonPrimary>` or `<CText>`, that has default font properties like font, size and so on. |
| 165 | +- NPM Package: [react-native-rename](https://www.npmjs.com/package/react-native-rename) |
176 | 166 |
|
177 |
| -#### Contributing |
| 167 | +### Contributing |
178 | 168 |
|
179 | 169 | Please check out [Contributing](https://github.com/AmitM30/react-native-typescript-boilerplate/blob/master/CONTRIBUTING.md).
|
180 | 170 |
|
181 |
| -#### Authors |
| 171 | +### Authors |
182 | 172 |
|
183 | 173 | - [**Anurag Chutani**](https://github.com/a7urag) - _Android Setup_
|
184 | 174 | - [**Brian Varley**](https://github.com/BrianJVarley) - _Windows Setup_
|
|
0 commit comments