|
1 |
| - |
2 | 1 | # react-native typescript TDD template
|
3 | 2 | This template is a react-native boilerplate project template to start with for new projects.
|
4 | 3 |
|
| 4 | + |
5 | 5 | ## Features
|
6 |
| -* [✅] **Typescript ready:** This template based on the typescript template [here](https://github.com/react-native-community/react-native-template-typescript |
7 |
| -) |
8 |
| -* [✅] **React Navigation ready:** Includes [react navigation](https://reactnavigation.org/) with basic working functionality out-of-the-box to work with. |
9 |
| -* [✅] **TDD ready:** Includes setup for [Jest](https://jestjs.io/), [Enzyme](https://enzymejs.github.io/enzyme/), [Detox](https://github.com/wix/Detox) for component and e2e testing. |
10 |
| -* [✅] **Lint ready:** ESlint. |
| 6 | + |
| 7 | +* [✅] **Typescript ready:** This template based on the typescript template [here](https://github.com/react-native-community/react-native-template-typescript) |
| 8 | + |
| 9 | +* [✅] **React Navigation ready:** Includes [react navigation](https://reactnavigation.org/) with basic working functionality out-of-the-box to work with. |
| 10 | + |
| 11 | +* [✅] **TDD ready:** Includes setup for [Jest](https://jestjs.io/), [Enzyme](https://enzymejs.github.io/enzyme/), [Detox](https://github.com/wix/Detox) for component and e2e testing. |
| 12 | + |
| 13 | +* [✅] **Lint ready:** ESlint. |
| 14 | + |
11 | 15 |
|
12 | 16 | ## Installation
|
13 | 17 | In the desired folder where you want to create the project, open command line and type:
|
14 | 18 |
|
15 |
| ->`npx react-native init {PROJECT_NAME} --template react-native-template-typescript-tdd` |
16 | 19 |
|
| 20 | +>`npx react-native init {PROJECT_NAME} --template react-native-template-typescript-tdd` |
17 | 21 |
|
18 | 22 | or if you want to install it from Github directly, type:
|
| 23 | + |
19 | 24 | >`react-native init {PROJECT_NAME} --template https://github.com/zaprogrammer/react-native-template-typescript-tdd.git`
|
20 | 25 |
|
21 | 26 |
|
22 | 27 | ## How to use
|
23 | 28 | This template uses functional components and [React Hooks](https://reactjs.org/docs/hooks-intro.html), but feel free to use class components, or use your preferred state-management library.
|
24 | 29 |
|
| 30 | + |
25 | 31 | ### Structure
|
26 | 32 | The template structure is as follows:
|
27 | 33 |
|
| 34 | + |
28 | 35 | #### src
|
29 |
| -The `src` folder is where all our development files/folders reside. |
30 | 36 |
|
31 |
| -- ##### App.tsx |
32 |
| - App entry point and starting screen, where your App function is defined. |
| 37 | +The `src` folder is where all our development files/folders reside. |
33 | 38 |
|
34 |
| -- ##### Navigation.tsx |
35 |
| - Contains basic navigation stack for main -> details screens. |
| 39 | +- **App.tsx** |
| 40 | +App entry point and starting screen, where your App function is defined. |
36 | 41 |
|
37 |
| -- ##### screens |
38 |
| - Folder to contains app screens (pages). I structured it to contain each screen in its separate folder, like **main, detail** folders where the screen.tsx and screenStyle.ts files exist. |
| 42 | +- **Navigation.tsx** |
| 43 | +Contains basic navigation stack for main -> details screens. |
39 | 44 |
|
40 |
| -- ##### model |
41 |
| - Contains data objects so to map data retrieved from server or DB to those objects. |
| 45 | +- **screens** |
| 46 | +Folder to contains app screens (pages). I structured it to contain each screen in its separate folder, like **main, detail** folders where the screen.tsx and screenStyle.ts files exist. |
42 | 47 |
|
43 |
| -- ##### services |
44 |
| - Contains API or server calling related classes, and includes an API.ts file as an abstract class to retrieve data from server. |
| 48 | +- **model** |
| 49 | +Contains data objects so to map data retrieved from server or DB to those objects. |
45 | 50 |
|
46 |
| -- ##### helper |
47 |
| - Other helper classes or functions like abstract DB layer. |
| 51 | +- **services** |
| 52 | +Contains API or server calling related classes, and includes an API.ts file as an abstract class to retrieve data from server. |
48 | 53 |
|
49 |
| -- ##### commons |
50 |
| - To contain any shared components or app generic functionality like app common styles. |
| 54 | +- **helper** |
| 55 | +Other helper classes or functions like abstract DB layer. |
51 | 56 |
|
| 57 | +- **commons** |
| 58 | +To contain any shared components or app generic functionality like app common styles. |
52 | 59 |
|
53 | 60 | #### TDD
|
54 |
| -There are a very good tutorials ([here](https://learntdd.in/react-native/)) covering how to use TDD with react-native so you can apply on this template. |
55 | 61 |
|
| 62 | +There are very good tutorials ([here](https://learntdd.in/react-native/)) covering how to use TDD with react-native so you can apply on this template. |
56 | 63 |
|
57 | 64 |
|
58 |
| -Official documentation for creating custom project templates can be found [here](https://github.com/react-native-community/cli/blob/master/docs/init.md#creating-custom-template |
59 |
| -). |
| 65 | +Official documentation for creating custom project templates can be found [here](https://github.com/react-native-community/cli/blob/master/docs/init.md#creating-custom-template). |
0 commit comments