Explorar el Código

Contributing guidelines & docs (#1542)

* add basic contributing guidelines to docs

* some English and formatting

* Add badges to README.md

* docs - how to run on android

* markdown formatting

* Add troubleshooting of old node

* Fix formattting

* Fix markdown and troubleshooting
Aaron Greenwald hace 7 años
padre
commit
fb6eadadeb
Se han modificado 2 ficheros con 80 adiciones y 34 borrados
  1. 67
    26
      CONTRIBUTING.md
  2. 13
    8
      README.md

+ 67
- 26
CONTRIBUTING.md Ver fichero

@@ -1,22 +1,8 @@
1 1
 # Contributing
2
-## Folder Structure
3 2
 
4
-| Folder | Description |
5
-| ------ | ----------- |
6
-| `lib` | The project itself composed of: |
7
-| `lib/android` | android sources and unit tests |
8
-| `lib/ios` | iOS sources and unit tests |
9
-| `lib/src` | javascript sources and unit tests |
10
-| `lib/src/index.js` | the entry point for `import Navigation from 'react-native-navigation'` |
11
-| `e2e` | [detox](https://github.com/wix/detox) iOS e2e tests (in the future, once detox supports it, we will have android e2e here as well) |
12
-| `AndroidE2E` | Android e2e tests using native uiautomator (until detox for android is ready) |
13
-| `playground` | The end-user project all e2e tests run against. Contains its own `src`, `android` and `ios`. Does not have its own package.json, depends on the local `<root>/lib` in order not to go through npm. |
14
-| `integration` | misc javascript integration tests |
15
-| `scripts` | all scripts |
16
-
17
-## Running locally
3
+Thanks for you interest in helping out! We'd love your contributions, and there's plenty of work to be done regardless of your skill level. Before you start, you'll need to have some things installed in your environment so that you can run locally.
18 4
 
19
-### Environment requirements
5
+## Environment Requirements
20 6
 
21 7
 * Mac OSX
22 8
 * Latest stable XCode
@@ -57,7 +43,71 @@ export CODE_SIGNING_REQUIRED=NO
57 43
 brew tap facebook/fb && brew install fbsimctl
58 44
 ```
59 45
 
60
-### Scripts
46
+## Basics - Getting Started
47
+
48
+Got your environment set up? Go ahead and clone the repo. (Fork it first so you can open a PR when you're ready.)
49
+
50
+Then:
51
+
52
+1. Install dependencies:
53
+
54
+    ```
55
+    yarn install
56
+    ```
57
+
58
+1. Run the playground project in Android and iOS so that you can get a feel for the project.
59
+  
60
+    1. `yarn start` to get the package running in a terminal, leave it open
61
+
62
+    1. iOS: `yarn xcode` & run the project from XCode
63
+    
64
+    1. Android: Open the app in Android Studio and click `Run`   
65
+
66
+1. Run the tests. Before you start changing things, make sure everything works.
67
+
68
+     ```
69
+     yarn test-all
70
+     ```
71
+
72
+## Troubleshooting
73
+
74
+* If the tests fail with an error like `Ineligible destinations for the "ReactNativeNavigation" scheme`, double check that you have the latest XCode installed.
75
+* If the tests fail because an Android emulator isn't available (something like `com.android.builder.testing.api.DeviceException: No connected devices!`), start the Android project from Android Studio and leave the emulator running, then try again.
76
+* If the tests fail with an error such as: 
77
+
78
+```js
79
+
80
+ beforeEach(async () => {
81
+                   ^
82
+SyntaxError: Unexpected token (
83
+
84
+```
85
+    
86
+You probably have an old node version which doesn't support async functions. Update your node using nvm according to the instructions above.
87
+
88
+## Workflow
89
+This project is driven by tests. Before implementing any feature or fixing any bug, a failing test (e2e or unit or both) should be added, depending on the environment of where the fix should be implemented. For example, for an API change, a failing e2e should be written. For a small bug fix in Android, for example, a unit test in Android should be added.
90
+
91
+This will ensure good quality throughout the life of the project and will avoid unexpected breakages.
92
+
93
+No PR will be accepted without adequate test coverage.
94
+
95
+## Folder Structure
96
+
97
+| Folder | Description |
98
+| ------ | ----------- |
99
+| `lib` | The project itself composed of: |
100
+| `lib/android` | android sources and unit tests |
101
+| `lib/ios` | iOS sources and unit tests |
102
+| `lib/src` | javascript sources and unit tests |
103
+| `lib/src/index.js` | the entry point for `import Navigation from 'react-native-navigation'` |
104
+| `e2e` | [detox](https://github.com/wix/detox) iOS e2e tests (in the future, once detox supports it, we will have android e2e here as well) |
105
+| `AndroidE2E` | Android e2e tests using native uiautomator (until detox for android is ready) |
106
+| `playground` | The end-user project all e2e tests run against. Contains its own `src`, `android` and `ios`. Does not have its own package.json, depends on the local `<root>/lib` in order not to go through npm. |
107
+| `integration` | misc javascript integration tests |
108
+| `scripts` | all scripts |
109
+
110
+## Scripts
61 111
 
62 112
 | Command | Description |
63 113
 | ------- | ----------- |
@@ -75,12 +125,3 @@ brew tap facebook/fb && brew install fbsimctl
75 125
 | `yarn test-e2e-android` | runs the android e2e suite (with uiautomator) in debug/release on running devices/emulators <br> **Options:** `-- [release] [just com.TestClass#testMethod]` |
76 126
 | `yarn test-all` | runs all tests in parallel |
77 127
 
78
-## Workflow
79
-This project is driven by tests. Before implementing any feature or fixing any bug, a failing test (e2e or unit or both) should be added, depending on the environment of where the fix should be implemented. For example, for an API change, a failing e2e should be written. For a small bug fix in Android, for example, a unit test in Android should be added.
80
-
81
-This will ensure good quality throughout the life of the project and will avoid unexpected breakages.
82
-
83
-No PR will be accepted without adequate test coverage.
84
-
85
-To run the tests, use the scripts above.
86
-

+ 13
- 8
README.md Ver fichero

@@ -1,3 +1,8 @@
1
+[![NPM Version](https://img.shields.io/npm/v/react-native-navigation.svg?style=flat)](https://www.npmjs.com/package/react-native-navigation)
2
+[![NPM Downloads](https://img.shields.io/npm/dm/react-native-navigation.svg?style=flat)](https://www.npmjs.com/package/react-native-navigation)
3
+[![Build Status](https://travis-ci.org/wix/react-native-navigation.svg?branch=v2)](https://travis-ci.org/wix/react-native-navigation)
4
+[![Join us on Discord](https://img.shields.io/badge/discord-react--native--navigation-738bd7.svg?style=flat)](https://discord.gg/DhkZjq2)
5
+
1 6
 #  React Native Navigation v2 (WIP)
2 7
 We are rebuilding react-native-navigation
3 8
 
@@ -5,19 +10,19 @@ We are rebuilding react-native-navigation
5 10
 - [Where is it standing now?](#where-is-it-standing-now)
6 11
 - [Getting Started](#getting-started-with-v2)
7 12
 - [Usage](#usage)
13
+- [Contributing](CONTRIBUTING.md)
8 14
 
9 15
 ## Why Rebuild react-native-navigation?
10 16
 
11
-### A New Improved Core Architecture
12
-react-native-navigation has a few issues which are unsolvable in it’s current architecture. <br>
13
-These issues originate from the same problem: you cannot specify on which screen you wish to make an action. Whenever you want to push a screen, show a modal or any other action, the action defaults to originate from your current screen. This covers most use cases but there are some edge cases: <br>
17
+### A New & Improved Core Architecture
18
+react-native-navigation has a few issues which are unsolvable in its current architecture. These issues stem from the same problem: you cannot specify on which screen you wish to make an action. Whenever you want to push a screen, show a modal or any other action, the action defaults to originate from your current screen. In most cases this is fine, but becoms problematic in specific edge cases. For example: <br>
14 19
 * What if you want to update your navbar icons and the user pops the screen? Your icons might update on the wrong screen.
15 20
 * What if you want to push a screen as a result of a redux action?
16 21
 
17 22
 There are ways to solve some of these problems in v1 but they are not straightforward. We want to change that.
18 23
 
19 24
 #### New API
20
-To solve this problem in v2, every screen receives as a prop its containerId. Whenever you want to perform an action from that screen you need to pass the containerId to the function:
25
+To solve this problem in v2, every screen receives its `containerId` as a prop. Whenever you want to perform an action from that screen you need to pass the `containerId` to the function:
21 26
 ```js
22 27
 Navigator.pop(this.props.containerId)
23 28
 ```
@@ -29,9 +34,9 @@ v2 is written with contributors in mind from day one.
29 34
 v2 is written in Test Driven Development. We have a test for every feature including features that are not implemented yet. This makes accepting pull requests extremely easy: If our tests pass, your pull request is accepted.
30 35
 
31 36
 
32
-## Where is it standing now?
33
-v2 currently supports most of react-native-navigation’s basic functions but it is still behind v1.
34
-Here is the full comparison of features between v1 and v2 (will be updated regulary):
37
+## Current Status
38
+v2 currently supports most of react-native-navigation’s basic functionality but it is still behind v1.
39
+Here is the full comparison of features between v1 and v2 (will be updated regularly):
35 40
 ### Top Level API
36 41
 
37 42
 |    API              | v1  | v2 |
@@ -71,7 +76,7 @@ Here is the full comparison of features between v1 and v2 (will be updated regul
71 76
 
72 77
 ### Styles
73 78
 
74
-Note:  properties who begin with 'navBar' in v1 are now named 'topBar' to avoid confusion with the android native bottom nav bar.
79
+Note:  v1 properties with names beginning with 'navBar' are replaced in v2 with properties beginning with 'topBar' to avoid confusion with the Android native bottom nav bar.
75 80
 
76 81
 |                       | v1  | v2 iOS | v2 Android |
77 82
 |-----------------------|-----|--------|------------|