Browse Source

Auto docs WIP (#2799)

* update api jsdoc

* iniline some properties

* add typedoc

* remove typedoc

* try again with typedoc

* explicit types

* docs

* try handlerbars

* working on docs

* update docs

* html

* removed old md

* trying stuff

* fix lint

* working on docs

* trying with themes

* something works

* trying to use automatically

* working on docs

* docs

* docs

* docw

* auto docs

* rename

* local-docs no cache

* automating

* ts-node

* working on something cool

* temp

* try fix travis

* Revert "try fix travis"

This reverts commit 5bcb54659b.

* removed dead files

* main readme inside docs

* softlink

* softlink

* docs working
Daniel Zlotin 6 years ago
parent
commit
931d8a4ae4
No account linked to committer's email address
61 changed files with 905 additions and 1617 deletions
  1. 0
    210
      README.md
  2. 1
    0
      README.md
  3. 213
    1
      docs/README.md
  4. BIN
      docs/_images/favicon.ico
  5. BIN
      docs/_images/logo.png
  6. 0
    1
      docs/_navbar.md
  7. 4
    17
      docs/_sidebar.md
  8. 1
    0
      docs/api/README.md
  9. 0
    11
      docs/docs/Component.md
  10. 0
    40
      docs/docs/INSTALLING.md
  11. 157
    0
      docs/docs/Installing.md
  12. 0
    167
      docs/docs/Navigation.md
  13. 0
    10
      docs/docs/Root.md
  14. 0
    10
      docs/docs/SideMenu.md
  15. 0
    2
      docs/docs/UPDATING.md
  16. 219
    0
      docs/docs/Usage.md
  17. 31
    68
      docs/docs/WorkingLocally.md
  18. 0
    138
      docs/docs/installation-android.md
  19. 0
    26
      docs/docs/installation-ios.md
  20. 0
    13
      docs/docs/options/BottomTab.md
  21. 0
    13
      docs/docs/options/BottomTabs.md
  22. 0
    15
      docs/docs/options/Button.md
  23. 0
    14
      docs/docs/options/NavigationOptions.md
  24. 0
    23
      docs/docs/options/TopBar.md
  25. 0
    9
      docs/docs/options/TopTab.md
  26. 0
    10
      docs/docs/options/TopTabs.md
  27. 0
    206
      docs/docs/usage.md
  28. 0
    339
      docs/docs/v1tov2diff.md
  29. 45
    49
      docs/index.html
  30. 0
    9
      docs/linkify.js
  31. 0
    1
      docs/stringify.js
  32. 7
    0
      docs/templates/class.hbs
  33. 0
    5
      docs/templates/docs.hbs
  34. 0
    3
      docs/templates/header.hbs
  35. 0
    25
      docs/templates/link.hbs
  36. 0
    4
      docs/templates/linked-type-list.hbs
  37. 1
    0
      docs/templates/main.hbs
  38. 13
    0
      docs/templates/method.hbs
  39. 0
    4
      docs/templates/param-table-name.hbs
  40. 0
    12
      docs/templates/params-table.hbs
  41. 0
    0
      docs/templates/scope.hbs
  42. 0
    14
      docs/templates/sig-name.hbs
  43. 4
    4
      integration/env.test.js
  44. 23
    38
      lib/src/Navigation.ts
  45. 1
    4
      lib/src/components/Lifecycle.ts
  46. 4
    4
      lib/src/events/PrivateEventsListener.ts
  47. 19
    13
      package.json
  48. 2
    1
      playground/README.md
  49. 0
    0
      scripts/env/env-android.sh
  50. 0
    0
      scripts/env/env-ios.sh
  51. 116
    0
      scripts/gen-docs.ts
  52. 0
    83
      scripts/generate-js-doc.js
  53. 32
    0
      scripts/local-docs.js
  54. 0
    0
      scripts/test-all.js
  55. 0
    0
      scripts/test-e2e-android-detox.js
  56. 0
    0
      scripts/test-e2e-android.js
  57. 0
    0
      scripts/test-e2e-ios.js
  58. 0
    0
      scripts/test-unit-android.js
  59. 0
    0
      scripts/test-unit-ios.js
  60. 9
    1
      tsconfig.json
  61. 3
    0
      tsn.sh

+ 0
- 210
README.md View File

@@ -1,210 +0,0 @@
1
-[![npm (tag)](https://img.shields.io/npm/v/react-native-navigation/alpha.svg)](https://github.com/wix/react-native-navigation/tree/v2#react-native-navigation-v2-wip)
2
-[![Build Status](https://travis-ci.org/wix/react-native-navigation.svg?branch=v2)](https://travis-ci.org/wix/react-native-navigation)
3
-[![Join us on Discord](https://img.shields.io/badge/discord-react--native--navigation-738bd7.svg?style=flat)](https://discord.gg/DhkZjq2)
4
-
5
-#  React Native Navigation v2 (WIP)
6
-We are rebuilding react-native-navigation.
7
-
8
-> As we are in stage alpha, expect breaking API changes or use a specific version (for example "2.0.1234")
9
-
10
-- [Why?](#why-rebuild-react-native-navigation)
11
-- [v2 Roadmap](#v2-roadmap)
12
-- [v1 vs v2 feature comparison](#v1-vs-v2-feature-comparison)
13
-- [Documentation](https://wix.github.io/react-native-navigation/v2/)
14
-- [Contributing](/docs/docs/CONTRIBUTING.md)
15
-
16
-## Why Rebuild react-native-navigation?
17
-
18
-### A New & Improved Core Architecture
19
-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 becomes problematic in specific edge cases. For example: <br>
20
-* What if you want to update your navbar icons and the user pops the screen? Your icons might update on the wrong screen.
21
-* What if you want to push a screen as a result of a redux action?
22
-
23
-There are ways to solve some of these problems in v1 but they are not straightforward. We want to change that.
24
-
25
-#### New API
26
-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:
27
-```js
28
-Navigator.pop(this.props.containerId)
29
-```
30
-### Built for Contributors
31
-Currently, it requires a lot of work to accept pull requests. We need to manually make sure that everything works before we approve them because v1 is not thoroughly tested. <br>
32
-v2 is written with contributors in mind from day one.
33
-
34
-#### Written In TDD
35
-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.
36
-
37
-## v2 Roadmap
38
-
39
-### Current Priorities
40
-
41
-1) buttons in Android
42
-2) showOverlay in iOS
43
-3) showOverlay in Android
44
-4) async commands
45
-5) currentTab
46
-6) change Options to be nested
47
-7) topTabs in both platforms, with API implications
48
-
49
-### Top API
50
-
51
-|       Top API         | iOS  | Android |
52
-|--------------------|-----|----|
53
-| setRoot   |   ✅    |   ✅  |
54
-| registerContainer |   ✅   |  ✅   |
55
-| container     |   ✅   |  ✅   |
56
-| sideMenu             |    ✅  |    ✅ |
57
-| tabs            |    ✅  |    ✅ |
58
-| customViewController           |   [Contribute](/docs/docs/CONTRIBUTING.md)  |   [Contribute](/docs/docs/CONTRIBUTING.md) |
59
-| splitView           |   [Contribute](/docs/docs/CONTRIBUTING.md)   |   [Contribute](/docs/docs/CONTRIBUTING.md) |
60
-
61
-### Screen API
62
-
63
-|       Screen API         | iOS  | Android |
64
-|--------------------|-----|----|
65
-| push              |   ✅       |	✅		|
66
-| pop               |  ✅        |	✅	|
67
-| popToRoot              |   ✅         |✅	|
68
-| resetTo             |   ✅        |	✅|
69
-| showModal              |  ✅        |	✅|
70
-| dismissModal           |     ✅       |	✅|
71
-| showOverlay             |  ✅         |	✅ |
72
-| dismissOverlay             |  ✅   |	✅ |
73
-| customTransition            |   ✅        |	[Contribute](/docs/docs/CONTRIBUTING.md) |
74
-| Screen Visibility        | ✅     |✅|
75
-| async commands (await push)     |  ✅        |✅   |
76
-
77
-### Navigation Options
78
-
79
-|       topBar         | iOS  | Android | contributors|
80
-|--------------------|-----|----|-----|
81
-| title         |        	✅    | 	✅| Wix|
82
-| textColor    | ✅     |     ✅        | Wix|
83
-| textFontSize       |    ✅      |     ✅        | Wix|
84
-| textFontFamily     |      ✅     |     ✅        | Wix |
85
-| backgroundColor    |  ✅       |     ✅         | Wix|
86
-| buttonColor         |    ✅      |     [Contribute](/docs/docs/CONTRIBUTING.md)        | Wix|
87
-| hidden             |   ✅      |     ✅        | Wix|
88
-| hideOnScroll         |  ✅    |     [Contribute](/docs/docs/CONTRIBUTING.md)        | Wix|
89
-| translucent         |   ✅     |     [Contribute](/docs/docs/CONTRIBUTING.md)        | Wix|
90
-| transparent         |  ✅        |     [Contribute](/docs/docs/CONTRIBUTING.md)        |
91
-| noBorder             |    ✅     |     [Contribute](/docs/docs/CONTRIBUTING.md)        |  @gtchance|
92
-| drawUnder         |    ✅     |      [Contribute](/docs/docs/CONTRIBUTING.md)       ||
93
-| blur               |    ✅     |      [Contribute](/docs/docs/CONTRIBUTING.md)       | @gtchance|
94
-| custom          |     WIP @gran33     | [Contribute](/docs/docs/CONTRIBUTING.md)|
95
-| subtitleColor            |   [Contribute](/docs/docs/CONTRIBUTING.md)     |      [Contribute](/docs/docs/CONTRIBUTING.md)      |
96
-| subtitleFontFamily      |    [Contribute](/docs/docs/CONTRIBUTING.md)    |     [Contribute](/docs/docs/CONTRIBUTING.md)       |
97
-| largeTitle (iOS 11)      |    ✅     |     /iOS Specific       |
98
-
99
-|       tabBar         | iOS  | Android | contributors|
100
-|--------------------|-----|----|-----|
101
-| drawUnder          |    ✅     |      [Contribute](/docs/docs/CONTRIBUTING.md)       | |
102
-| hidden   |   ✅     |    ✅        | @gtchance |
103
-| tabBadge          |       ✅    | [Contribute](/docs/docs/CONTRIBUTING.md)| Wix|
104
-| currentTab by Index          |       ✅    | ✅ | Wix |
105
-| currentTab by cointainerId         |       [Contribute](/docs/docs/CONTRIBUTING.md)    | ✅ | Wix |
106
-
107
-|       buttons        | iOS  | Android | contributors|
108
-|--------------------|-----|----|-----|
109
-| id    |   ✅      |     @Johan-dutoit  |@Johan-dutoit|
110
-| testID   |     ✅   |   [Contribute](/docs/docs/CONTRIBUTING.md)  | @Johan-dutoit|
111
-| color             |    ✅     |     @Johan-dutoit     | @Johan-dutoit|
112
-| icon          |   ✅     |    @Johan-dutoit     | @Johan-dutoit|
113
-| disableTint        |    ✅       |    @Johan-dutoit    | @Johan-dutoit|
114
-| fontSize        |    ✅       |    @Johan-dutoit    | @Johan-dutoit |
115
-| fontWeight        |    ✅       |    [Contribute](/docs/docs/CONTRIBUTING.md)   |  [Contribute](/docs/docs/CONTRIBUTING.md) |
116
-
117
-|       statusBar        | iOS  | Android | contributors|
118
-|--------------------|-----|----|-----|
119
-| textColorScheme    |   in development      |      / iOS specific    |
120
-| textColorSchemeSingleScreen   |     in development    |     / iOS specific      |
121
-| blur             |    ✅     |      [Contribute](/docs/docs/CONTRIBUTING.md)       | @gtchance|
122
-| hideWithTopBar          |   ✅     |     [Contribute](/docs/docs/CONTRIBUTING.md)       | @gtchance|
123
-| hidden         |    ✅       |     [Contribute](/docs/docs/CONTRIBUTING.md)      | WIX |
124
-
125
-|       other        | iOS  | Android | contributors|
126
-|--------------------|-----|----|-----|
127
-| screenBackgroundColor        |   ✅     |     [Contribute](/docs/docs/CONTRIBUTING.md)       |  Wix|
128
-| orientation       |    ✅     |   [Contribute](/docs/docs/CONTRIBUTING.md)          | Wix|
129
-| disabledBackGesture        |    ✅     |    / iOS specific     |
130
-| screenBackgroundImageName        |   ✅      |    [Contribute](/docs/docs/CONTRIBUTING.md)        |
131
-| rootBackgroundImageName              |    ✅     |    [Contribute](/docs/docs/CONTRIBUTING.md)       |
132
-| sideMenuVisible          |      ✅   | [Contribute](/docs/docs/CONTRIBUTING.md) |
133
-
134
-
135
-## v1 vs v2 Feature Comparison
136
-v2 currently supports most of react-native-navigation’s basic functionality but it is still behind v1.
137
-Here is the full comparison of features between v1 and v2 (will be updated regularly):
138
-### Top Level API
139
-
140
-|    API              | v1  | v2 |
141
-|--------------------|-----|----|
142
-| startTabBasedApp   |   ✅    |   ✅  |
143
-| startSinglePageApp |   ✅   |  ✅   |
144
-| registerScreen     |   ✅   |  ✅   |
145
-| drawer             |    ✅  |    ✅ |
146
-### Screen API
147
-
148
-|  API              | v1     | v2  iOS      |	v2 Android |
149
-|---------------------|--------|------------|--------------|
150
-| push                |  ✅     |   ✅       |	✅		|
151
-| pop                 |  ✅     |  ✅        |	✅	|
152
-| showModal           |  ✅     |  ✅        |	✅|
153
-| popToRoot           |   ✅     |   ✅         |✅	|
154
-| resetTo             |   ✅     |    ✅        |	✅|
155
-| dismissModal        |   ✅     |     ✅       |	✅|
156
-| dismissAllModals    |   ✅     |      ✅      |	✅|
157
-| showContextualMenu      |   ✅     |     / Android specific       |[Contribute](/docs/docs/CONTRIBUTING.md) |
158
-| dismissContextualMenu      |   ✅     |   / Androic specific        |[Contribute](/docs/docs/CONTRIBUTING.md)  |
159
-| showFab      |   ✅     |    / Android specific     |  [Contribute](/docs/docs/CONTRIBUTING.md)  |
160
-| dismissFab      |   ✅     |    / Android specific       | [Contribute](/docs/docs/CONTRIBUTING.md) |
161
-| showSnackBar     |   ✅     |     / Android specific    |   [Contribute](/docs/docs/CONTRIBUTING.md) |
162
-| dismissSnackBar     |   ✅     |    / Android specific      |  [Contribute](/docs/docs/CONTRIBUTING.md) |
163
-| showLightBox        |   ✅     |      [Contribute](/docs/docs/CONTRIBUTING.md)      | [Contribute](/docs/docs/CONTRIBUTING.md)  |
164
-| dismissLightBox     |   ✅     |       [Contribute](/docs/docs/CONTRIBUTING.md)       | [Contribute](/docs/docs/CONTRIBUTING.md) |
165
-| handleDeepLink      |   ✅     |       [Contribute](/docs/docs/CONTRIBUTING.md)       | [Contribute](/docs/docs/CONTRIBUTING.md) |
166
-| Screen Visibility   |   ✅     |       ✅     |✅|
167
-
168
-### Styles
169
-
170
-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.
171
-
172
-|                       | v1  | v2 iOS | v2 Android | Contributors |
173
-|-----------------------|-----|--------|------------|------------|
174
-| topBarTextColor |   ✅    |    ✅     |     ✅        | Wix|
175
-| topBarTextFontSize    |   ✅    |    ✅      |     ✅        | Wix|
176
-| topBarTextFontFamily  |  ✅     |      ✅     |     ✅        | Wix |
177
-| topBarBackgroundColor |  ✅     |  ✅       |     ✅         | Wix|
178
-| topBarButtonColor     |  ✅     |    ✅      |     [Contribute](/docs/docs/CONTRIBUTING.md)        | Wix|
179
-| topBarHidden          |   ✅    |   ✅      |     ✅        | Wix|
180
-| topBarHideOnScroll    |  ✅     |  ✅    |     [Contribute](/docs/docs/CONTRIBUTING.md)        | Wix|
181
-| topBarTranslucent     |  ✅     |   ✅     |     [Contribute](/docs/docs/CONTRIBUTING.md)        | Wix|
182
-| topBarTransparent     | ✅      |   WIP @bogobogo     |     [Contribute](/docs/docs/CONTRIBUTING.md)        |
183
-| topBarNoBorder        |  ✅     |    ✅     |     [Contribute](/docs/docs/CONTRIBUTING.md)        |  @gtchance|
184
-| drawUnderTabBar       |  ✅     |    ✅     |      [Contribute](/docs/docs/CONTRIBUTING.md)       | |
185
-| drawUnderTopBar       |  ✅     |    ✅     |      [Contribute](/docs/docs/CONTRIBUTING.md)       ||
186
-| statusBarBlur         |  ✅     |    ✅     |      [Contribute](/docs/docs/CONTRIBUTING.md)       | @gtchance|
187
-| topBarBlur            | ✅      |    ✅     |      [Contribute](/docs/docs/CONTRIBUTING.md)       | @gtchance|
188
-| tabBarHidden  |   ✅  |   ✅     |    [Contribute](/docs/docs/CONTRIBUTING.md)        | @gtchance|
189
-| statusBarTextColorScheme |  ✅   |   in development      |      / iOS specific    |
190
-| statusBarTextColorSchemeSingleScreen|  ✅   |     in development    |     / iOS specific      |
191
-| topBarSubtitleColor          |  ✅   |   [Contribute](/docs/docs/CONTRIBUTING.md)     |      [Contribute](/docs/docs/CONTRIBUTING.md)      |
192
-| topBarSubtitleFontFamily    |   ✅  |    [Contribute](/docs/docs/CONTRIBUTING.md)    |     [Contribute](/docs/docs/CONTRIBUTING.md)       |
193
-| screenBackgroundColor     | ✅    |   ✅     |     [Contribute](/docs/docs/CONTRIBUTING.md)       |  Wix|
194
-| orientation     |  ✅   |    ✅     |   [Contribute](/docs/docs/CONTRIBUTING.md)          | Wix|
195
-| statusBarHideWithTopBar        |  ✅   |   ✅     |     [Contribute](/docs/docs/CONTRIBUTING.md)       | @gtchance|
196
-| statusBarHidden       |  ✅   |    ✅       |     [Contribute](/docs/docs/CONTRIBUTING.md)      | WIX |
197
-| disabledBackGesture       |   ✅  |   ✅  |    / iOS specific     |
198
-| screenBackgroundImageName         |   ✅  |   ✅      |    [Contribute](/docs/docs/CONTRIBUTING.md)        |
199
-| rootBackgroundImageName            |  ✅   |    ✅     |    [Contribute](/docs/docs/CONTRIBUTING.md)       |
200
-| setButtons          |   ✅     |    ✅    | [Contribute](/docs/docs/CONTRIBUTING.md) | @Johan-dutoit|
201
-| title            |   ✅     |        	✅    | 	✅| Wix|
202
-| toggleDrawer        |   ✅     |       ✅    | [Contribute](/docs/docs/CONTRIBUTING.md) |
203
-| setTabBadge         |    ✅    |       ✅    | [Contribute](/docs/docs/CONTRIBUTING.md)| Wix|
204
-| switchToTab         |    ✅    |       ✅   |[Contribute](/docs/docs/CONTRIBUTING.md) |
205
-| topBarCustomView        |   ✅     |     WIP @gran33     | [Contribute](/docs/docs/CONTRIBUTING.md)|
206
-| customTransition(shared element)       |     :x:  |     WIP @bogobogo     | [Contribute](/docs/docs/CONTRIBUTING.md)|
207
-| splitViewScreen       |     :x:  |    [Contribute](/docs/docs/CONTRIBUTING.md)      | [Contribute](/docs/docs/CONTRIBUTING.md)|
208
-
209
-Element transitions, adding buttons and styles are not yet implemented. [Contribute](/docs/docs/CONTRIBUTING.md)
210
-

+ 1
- 0
README.md View File

@@ -0,0 +1 @@
1
+docs/README.md

+ 213
- 1
docs/README.md View File

@@ -1 +1,213 @@
1
-# React Native Navigation V2
1
+[![npm (tag)](https://img.shields.io/npm/v/react-native-navigation/alpha.svg)](https://github.com/wix/react-native-navigation/tree/v2#react-native-navigation-v2-wip)
2
+[![Build Status](https://travis-ci.org/wix/react-native-navigation.svg?branch=v2)](https://travis-ci.org/wix/react-native-navigation)
3
+[![Join us on Discord](https://img.shields.io/badge/discord-react--native--navigation-738bd7.svg?style=flat)](https://discord.gg/DhkZjq2)
4
+[![StackExchange](https://img.shields.io/stackexchange/stackoverflow/t/react-native-navigation.svg)](https://stackoverflow.com/questions/tagged/react-native-navigation)
5
+
6
+
7
+#  React Native Navigation v2 (WIP)
8
+We are rebuilding react-native-navigation.
9
+
10
+> As we are in stage alpha, expect breaking API changes or use a specific version (for example "2.0.1234")
11
+
12
+- [Why?](#why-rebuild-react-native-navigation)
13
+- [v2 Roadmap](#v2-roadmap)
14
+- [v1 vs v2 feature comparison](#v1-vs-v2-feature-comparison)
15
+- [Documentation](https://wix.github.io/react-native-navigation/v2/)
16
+- [Contributing](/docs/WorkingLocally.md)
17
+
18
+## Why Rebuild react-native-navigation?
19
+
20
+### A New & Improved Core Architecture
21
+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 becomes problematic in specific edge cases. For example: <br>
22
+* What if you want to update your navbar icons and the user pops the screen? Your icons might update on the wrong screen.
23
+* What if you want to push a screen as a result of a redux action?
24
+
25
+There are ways to solve some of these problems in v1 but they are not straightforward. We want to change that.
26
+
27
+#### New API
28
+To solve this problem in v2, every screen receives its `componentId` as a prop. Whenever you want to perform an action from that screen you need to pass the `componentId` to the function:
29
+```js
30
+Navigator.pop(this.props.componentId)
31
+```
32
+Another big architectural change is that now you can compose arbitrary native layout hierarchies, and assign a custom `id` to each and control them individually.
33
+
34
+### Built for Contributors
35
+Currently, it requires a lot of work to accept pull requests. We need to manually make sure that everything works before we approve them because v1 is not thoroughly tested. <br>
36
+v2 is written with contributors in mind from day one.
37
+
38
+#### Written In TDD
39
+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.
40
+
41
+## v2 Roadmap
42
+
43
+### Current Priorities
44
+
45
+1) buttons in Android
46
+2) showOverlay in iOS
47
+3) showOverlay in Android
48
+4) async commands
49
+5) currentTab
50
+6) change Options to be nested
51
+7) topTabs in both platforms, with API implications
52
+
53
+### Top API
54
+
55
+|       Top API         | iOS  | Android |
56
+|--------------------|-----|----|
57
+| setRoot   |   ✅    |   ✅  |
58
+| registerContainer |   ✅   |  ✅   |
59
+| container     |   ✅   |  ✅   |
60
+| sideMenu             |    ✅  |    ✅ |
61
+| tabs            |    ✅  |    ✅ |
62
+| customViewController           |   [Contribute](/docs/WorkingLocally.md)  |   [Contribute](/docs/WorkingLocally.md) |
63
+| splitView           |   [Contribute](/docs/WorkingLocally.md)   |   [Contribute](/docs/WorkingLocally.md) |
64
+
65
+### Screen API
66
+
67
+|       Screen API         | iOS  | Android |
68
+|--------------------|-----|----|
69
+| push              |   ✅       |	✅		|
70
+| pop               |  ✅        |	✅	|
71
+| popToRoot              |   ✅         |✅	|
72
+| resetTo             |   ✅        |	✅|
73
+| showModal              |  ✅        |	✅|
74
+| dismissModal           |     ✅       |	✅|
75
+| showOverlay             |  ✅         |	✅ |
76
+| dismissOverlay             |  ✅   |	✅ |
77
+| customTransition            |   ✅        |	[Contribute](/docs/WorkingLocally.md) |
78
+| Screen Visibility        | ✅     |✅|
79
+| async commands (await push)     |  ✅        |✅   |
80
+
81
+### Navigation Options
82
+
83
+|       topBar         | iOS  | Android | contributors|
84
+|--------------------|-----|----|-----|
85
+| title         |        	✅    | 	✅| Wix|
86
+| textColor    | ✅     |     ✅        | Wix|
87
+| textFontSize       |    ✅      |     ✅        | Wix|
88
+| textFontFamily     |      ✅     |     ✅        | Wix |
89
+| backgroundColor    |  ✅       |     ✅         | Wix|
90
+| buttonColor         |    ✅      |     [Contribute](/docs/WorkingLocally.md)        | Wix|
91
+| hidden             |   ✅      |     ✅        | Wix|
92
+| hideOnScroll         |  ✅    |     [Contribute](/docs/WorkingLocally.md)        | Wix|
93
+| translucent         |   ✅     |     [Contribute](/docs/WorkingLocally.md)        | Wix|
94
+| transparent         |  ✅        |     [Contribute](/docs/WorkingLocally.md)        |
95
+| noBorder             |    ✅     |     [Contribute](/docs/WorkingLocally.md)        |  @gtchance|
96
+| drawUnder         |    ✅     |      [Contribute](/docs/WorkingLocally.md)       ||
97
+| blur               |    ✅     |      [Contribute](/docs/WorkingLocally.md)       | @gtchance|
98
+| custom          |     WIP @gran33     | [Contribute](/docs/WorkingLocally.md)|
99
+| subtitleColor            |   [Contribute](/docs/WorkingLocally.md)     |      [Contribute](/docs/WorkingLocally.md)      |
100
+| subtitleFontFamily      |    [Contribute](/docs/WorkingLocally.md)    |     [Contribute](/docs/WorkingLocally.md)       |
101
+| largeTitle (iOS 11)      |    ✅     |     /iOS Specific       |
102
+
103
+|       tabBar         | iOS  | Android | contributors|
104
+|--------------------|-----|----|-----|
105
+| drawUnder          |    ✅     |      [Contribute](/docs/WorkingLocally.md)       | |
106
+| hidden   |   ✅     |    ✅        | @gtchance |
107
+| tabBadge          |       ✅    | [Contribute](/docs/WorkingLocally.md)| Wix|
108
+| currentTab by Index          |       ✅    | ✅ | Wix |
109
+| currentTab by cointainerId         |       [Contribute](/docs/WorkingLocally.md)    | ✅ | Wix |
110
+
111
+|       buttons        | iOS  | Android | contributors|
112
+|--------------------|-----|----|-----|
113
+| id    |   ✅      |     @Johan-dutoit  |@Johan-dutoit|
114
+| testID   |     ✅   |   [Contribute](/docs/WorkingLocally.md)  | @Johan-dutoit|
115
+| color             |    ✅     |     @Johan-dutoit     | @Johan-dutoit|
116
+| icon          |   ✅     |    @Johan-dutoit     | @Johan-dutoit|
117
+| disableTint        |    ✅       |    @Johan-dutoit    | @Johan-dutoit|
118
+| fontSize        |    ✅       |    @Johan-dutoit    | @Johan-dutoit |
119
+| fontWeight        |    ✅       |    [Contribute](/docs/WorkingLocally.md)   |  [Contribute](/docs/WorkingLocally.md) |
120
+
121
+|       statusBar        | iOS  | Android | contributors|
122
+|--------------------|-----|----|-----|
123
+| textColorScheme    |   in development      |      / iOS specific    |
124
+| textColorSchemeSingleScreen   |     in development    |     / iOS specific      |
125
+| blur             |    ✅     |      [Contribute](/docs/WorkingLocally.md)       | @gtchance|
126
+| hideWithTopBar          |   ✅     |     [Contribute](/docs/WorkingLocally.md)       | @gtchance|
127
+| hidden         |    ✅       |     [Contribute](/docs/WorkingLocally.md)      | WIX |
128
+
129
+|       other        | iOS  | Android | contributors|
130
+|--------------------|-----|----|-----|
131
+| screenBackgroundColor        |   ✅     |     [Contribute](/docs/WorkingLocally.md)       |  Wix|
132
+| orientation       |    ✅     |   [Contribute](/docs/WorkingLocally.md)          | Wix|
133
+| disabledBackGesture        |    ✅     |    / iOS specific     |
134
+| screenBackgroundImageName        |   ✅      |    [Contribute](/docs/WorkingLocally.md)        |
135
+| rootBackgroundImageName              |    ✅     |    [Contribute](/docs/WorkingLocally.md)       |
136
+| sideMenuVisible          |      ✅   | [Contribute](/docs/WorkingLocally.md) |
137
+
138
+
139
+## v1 vs v2 Feature Comparison
140
+v2 currently supports most of react-native-navigation’s basic functionality but it is still behind v1.
141
+Here is the full comparison of features between v1 and v2 (will be updated regularly):
142
+### Top Level API
143
+
144
+|    API              | v1  | v2 |
145
+|--------------------|-----|----|
146
+| startTabBasedApp   |   ✅    |   ✅  |
147
+| startSinglePageApp |   ✅   |  ✅   |
148
+| registerScreen     |   ✅   |  ✅   |
149
+| drawer             |    ✅  |    ✅ |
150
+### Screen API
151
+
152
+|  API              | v1     | v2  iOS      |	v2 Android |
153
+|---------------------|--------|------------|--------------|
154
+| push                |  ✅     |   ✅       |	✅		|
155
+| pop                 |  ✅     |  ✅        |	✅	|
156
+| showModal           |  ✅     |  ✅        |	✅|
157
+| popToRoot           |   ✅     |   ✅         |✅	|
158
+| resetTo             |   ✅     |    ✅        |	✅|
159
+| dismissModal        |   ✅     |     ✅       |	✅|
160
+| dismissAllModals    |   ✅     |      ✅      |	✅|
161
+| showContextualMenu      |   ✅     |     / Android specific       |[Contribute](/docs/WorkingLocally.md) |
162
+| dismissContextualMenu      |   ✅     |   / Androic specific        |[Contribute](/docs/WorkingLocally.md)  |
163
+| showFab      |   ✅     |    / Android specific     |  [Contribute](/docs/WorkingLocally.md)  |
164
+| dismissFab      |   ✅     |    / Android specific       | [Contribute](/docs/WorkingLocally.md) |
165
+| showSnackBar     |   ✅     |     / Android specific    |   [Contribute](/docs/WorkingLocally.md) |
166
+| dismissSnackBar     |   ✅     |    / Android specific      |  [Contribute](/docs/WorkingLocally.md) |
167
+| showLightBox        |   ✅     |      [Contribute](/docs/WorkingLocally.md)      | [Contribute](/docs/WorkingLocally.md)  |
168
+| dismissLightBox     |   ✅     |       [Contribute](/docs/WorkingLocally.md)       | [Contribute](/docs/WorkingLocally.md) |
169
+| handleDeepLink      |   ✅     |       [Contribute](/docs/WorkingLocally.md)       | [Contribute](/docs/WorkingLocally.md) |
170
+| Screen Visibility   |   ✅     |       ✅     |✅|
171
+
172
+### Styles
173
+
174
+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.
175
+
176
+|                       | v1  | v2 iOS | v2 Android | Contributors |
177
+|-----------------------|-----|--------|------------|------------|
178
+| topBarTextColor |   ✅    |    ✅     |     ✅        | Wix|
179
+| topBarTextFontSize    |   ✅    |    ✅      |     ✅        | Wix|
180
+| topBarTextFontFamily  |  ✅     |      ✅     |     ✅        | Wix |
181
+| topBarBackgroundColor |  ✅     |  ✅       |     ✅         | Wix|
182
+| topBarButtonColor     |  ✅     |    ✅      |     [Contribute](/docs/WorkingLocally.md)        | Wix|
183
+| topBarHidden          |   ✅    |   ✅      |     ✅        | Wix|
184
+| topBarHideOnScroll    |  ✅     |  ✅    |     [Contribute](/docs/WorkingLocally.md)        | Wix|
185
+| topBarTranslucent     |  ✅     |   ✅     |     [Contribute](/docs/WorkingLocally.md)        | Wix|
186
+| topBarTransparent     | ✅      |   WIP @bogobogo     |     [Contribute](/docs/WorkingLocally.md)        |
187
+| topBarNoBorder        |  ✅     |    ✅     |     [Contribute](/docs/WorkingLocally.md)        |  @gtchance|
188
+| drawUnderTabBar       |  ✅     |    ✅     |      [Contribute](/docs/WorkingLocally.md)       | |
189
+| drawUnderTopBar       |  ✅     |    ✅     |      [Contribute](/docs/WorkingLocally.md)       ||
190
+| statusBarBlur         |  ✅     |    ✅     |      [Contribute](/docs/WorkingLocally.md)       | @gtchance|
191
+| topBarBlur            | ✅      |    ✅     |      [Contribute](/docs/WorkingLocally.md)       | @gtchance|
192
+| tabBarHidden  |   ✅  |   ✅     |    [Contribute](/docs/WorkingLocally.md)        | @gtchance|
193
+| statusBarTextColorScheme |  ✅   |   in development      |      / iOS specific    |
194
+| statusBarTextColorSchemeSingleScreen|  ✅   |     in development    |     / iOS specific      |
195
+| topBarSubtitleColor          |  ✅   |   [Contribute](/docs/WorkingLocally.md)     |      [Contribute](/docs/WorkingLocally.md)      |
196
+| topBarSubtitleFontFamily    |   ✅  |    [Contribute](/docs/WorkingLocally.md)    |     [Contribute](/docs/WorkingLocally.md)       |
197
+| screenBackgroundColor     | ✅    |   ✅     |     [Contribute](/docs/WorkingLocally.md)       |  Wix|
198
+| orientation     |  ✅   |    ✅     |   [Contribute](/docs/WorkingLocally.md)          | Wix|
199
+| statusBarHideWithTopBar        |  ✅   |   ✅     |     [Contribute](/docs/WorkingLocally.md)       | @gtchance|
200
+| statusBarHidden       |  ✅   |    ✅       |     [Contribute](/docs/WorkingLocally.md)      | WIX |
201
+| disabledBackGesture       |   ✅  |   ✅  |    / iOS specific     |
202
+| screenBackgroundImageName         |   ✅  |   ✅      |    [Contribute](/docs/WorkingLocally.md)        |
203
+| rootBackgroundImageName            |  ✅   |    ✅     |    [Contribute](/docs/WorkingLocally.md)       |
204
+| setButtons          |   ✅     |    ✅    | [Contribute](/docs/WorkingLocally.md) | @Johan-dutoit|
205
+| title            |   ✅     |        	✅    | 	✅| Wix|
206
+| toggleDrawer        |   ✅     |       ✅    | [Contribute](/docs/WorkingLocally.md) |
207
+| setTabBadge         |    ✅    |       ✅    | [Contribute](/docs/WorkingLocally.md)| Wix|
208
+| switchToTab         |    ✅    |       ✅   |[Contribute](/docs/WorkingLocally.md) |
209
+| topBarCustomView        |   ✅     |     WIP @gran33     | [Contribute](/docs/WorkingLocally.md)|
210
+| customTransition(shared element)       |     :x:  |     WIP @bogobogo     | [Contribute](/docs/WorkingLocally.md)|
211
+| splitViewScreen       |     :x:  |    [Contribute](/docs/WorkingLocally.md)      | [Contribute](/docs/WorkingLocally.md)|
212
+
213
+Element transitions, adding buttons and styles are not yet implemented. [Contribute](/docs/WorkingLocally.md)

BIN
docs/_images/favicon.ico View File


BIN
docs/_images/logo.png View File


+ 0
- 1
docs/_navbar.md View File

@@ -1 +0,0 @@
1
-- [Github](https://github.com/wix/react-native-navigation/tree/v2)

+ 4
- 17
docs/_sidebar.md View File

@@ -1,18 +1,5 @@
1
-- Getting started
2
- - [Installation - iOS](/docs/installation-ios)
3
- - [Installation - Android](/docs/installation-android)
4
- - [Usage](/docs/usage)
1
+- Getting Started
2
+  - [Installing](/docs/Installing)
3
+  - [Working Locally](/docs/WorkingLocally)
4
+  - [Usage](/docs/Usage)
5 5
 - API
6
- - [Top Level](/docs/Navigation)
7
-- Params
8
- - [Root](/docs/Root)
9
- - [Component](/docs/Component)
10
- - [SideMenu](/docs/SideMenu)
11
-- Options
12
- - [NavigationOptions](/docs/options/NavigationOptions)
13
- - [TopBar](/docs/options/TopBar)
14
- - [TopTabs](/docs/options/TopTabs)
15
- - [TopTab](/docs/options/TopTab)
16
- - [Button](/docs/options/Button)
17
- - [BottomTabs](/docs/options/BottomTabs)
18
- - [BottomTab](/docs/options/BottomTab)

+ 1
- 0
docs/api/README.md View File

@@ -0,0 +1 @@
1
+WIP

+ 0
- 11
docs/docs/Component.md View File

@@ -1,11 +0,0 @@
1
-<h1>Component</h1>
2
-
3
-**Properties**
4
-
5
-| Name | Type | Description |
6
-| --- | --- | --- |
7
-| name | <code>string</code> | The components registered name |
8
-| topTabs | [<code>Array.&lt;Component&gt;</code>](#Component) |  |
9
-| passProps | <code>object</code> | props |
10
-| options | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/Options">Options</a> |  |
11
-

+ 0
- 40
docs/docs/INSTALLING.md View File

@@ -1,40 +0,0 @@
1
-# Installing
2
-
3
-### Add dependency
4
-`npm install --save react-native-navigation@alpha`
5
-
6
-### Configure Xcode
7
-drag-drop `node_modules/react-native-navigation/lib/ios/ReactNativeNavigation.xcodeproj` into Libraries folder in xcode (along the rest of react)
8
-
9
-Add ReactNativeNavigation into build-phases
10
-
11
-### Configure Gradle
12
-add `compile project(':react-native-navigation')` in build.gradle under dependencies.
13
-
14
-add
15
-
16
-```
17
-include ':react-native-navigation'
18
-project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app/')
19
-```
20
-in settings.gradle
21
-
22
-### Setup iOS
23
-in AppDelegate:
24
-
25
-add:
26
-
27
-`#import <ReactNativeNavigation/ReactNativeNavigation.h>`
28
-
29
-remove everything in the method didFinishLaunchingWithOptions and add:
30
-
31
-```
32
-NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
33
-[ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
34
-```
35
-
36
-### Setup Android
37
-
38
-Make your Application object extend from `NavigationApplication` and implement `isDebug` as `{YOUR_PACKAGE_NAME}.BuildConfig.DEBUG`
39
-
40
-Make your Acitivty extend from `NavigationActivity`

+ 157
- 0
docs/docs/Installing.md View File

@@ -0,0 +1,157 @@
1
+# Installing
2
+
3
+## Requirements
4
+* node >= 8
5
+* react-native >= 0.51
6
+
7
+## npm
8
+* `npm install --save react-native-navigation@alpha`
9
+
10
+## iOS
11
+
12
+> Make sure your Xcode is updated. We recommend editing `.h` and `.m` files in Xcode as the IDE will usually point out common errors.
13
+
14
+1. In Xcode, in Project Navigator (left pane), right-click on the `Libraries` > `Add files to [project name]`. Add `node_modules/react-native-navigation/lib/ios/ReactNativeNavigation.xcodeproj` ([screenshots](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#manual-linking)).
15
+
16
+2. In Xcode, in Project Navigator (left pane), click on your project (top), then click on your *target* row (on the "project and targets list", which is on the left column of the right pane) and select the `Build Phases` tab (right pane). In the `Link Binary With Libraries` section add `libReactNativeNavigation.a` ([screenshots](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#step-2)).
17
+
18
+3. In Xcode, you will need to edit this file: `AppDelegate.m`. This function is the main entry point for your app:
19
+
20
+	```objectivec
21
+	 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { ... }
22
+
23
+	```
24
+  
25
+  Its contents must be replaced with the contents of this [reference](https://github.com/wix/react-native-navigation/blob/v2/playground/ios/playground/AppDelegate.m#L16).
26
+  
27
+
28
+## Android
29
+
30
+> Make sure your Android Studio installation is updated. We recommend editing `gradle` and `java` files in Android Studio as the IDE will suggest fixes and point out errors, this way you avoid most common pitfalls.
31
+
32
+1. Add the following in `android/settings.gradle`:
33
+
34
+	```groovy
35
+	include ':react-native-navigation'
36
+	project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app/')
37
+	```
38
+
39
+2. Update `android/build.gradle`:
40
+
41
+	```diff
42
+	buildscript {
43
+	    repositories {
44
+	+        google()
45
+	+        mavenLocal()
46
+	+        mavenCentral()
47
+	+        jcenter()
48
+	    }
49
+	    dependencies {
50
+	+        classpath 'com.android.tools.build:gradle:3.0.1'
51
+	-        classpath 'com.android.tools.build:gradle:2.2.3'
52
+	    }
53
+	}
54
+	
55
+	allprojects {
56
+	    repositories {
57
+	+		google()
58
+	+		mavenCentral()
59
+	+		mavenLocal()
60
+			jcenter()
61
+			maven {
62
+	           // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
63
+	           url "$rootDir/../../node_modules/react-native/android"
64
+			}
65
+		}
66
+	}
67
+	```
68
+
69
+3. Update project dependencies in `android/app/build.gradle`.
70
+
71
+	```groovy
72
+	android {
73
+	    compileSdkVersion 25
74
+	    buildToolsVersion "27.0.3"
75
+	    
76
+	    defaultConfig {
77
+	        minSdkVersion 19
78
+	        targetSdkVersion 25
79
+		...
80
+	    }
81
+	
82
+	    compileOptions {
83
+	        sourceCompatibility JavaVersion.VERSION_1_8
84
+	        targetCompatibility JavaVersion.VERSION_1_8
85
+	    }
86
+	    ...
87
+	}
88
+	
89
+	dependencies {
90
+	    implementation fileTree(dir: "libs", include: ["*.jar"])
91
+	    implementation "com.android.support:appcompat-v7:25.4.0"
92
+	    implementation "com.facebook.react:react-native:+"
93
+	    implementation project(':react-native-navigation')
94
+	}
95
+	```
96
+	
97
+4. Make sure you're using the new gradle plugin, edit `android/gradle/wrapper/gradle-wrapper.properties`
98
+
99
+	```diff
100
+	distributionBase=GRADLE_USER_HOME
101
+	distributionPath=wrapper/dists
102
+	zipStoreBase=GRADLE_USER_HOME
103
+	zipStorePath=wrapper/dists
104
+	+distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
105
+	-distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
106
+	```
107
+
108
+5. Update `gradle.properties` and disable incremental resource processing
109
+
110
+	```diff
111
+	+# Disable incremental resource processing as it broke relase build
112
+	+android.enableAapt2=false
113
+	```
114
+
115
+6. In `MainActivity.java` it should extend `com.reactnativenavigation.NavigationActivity` instead of `ReactActivity`.
116
+
117
+	This file can be located in `android/app/src/main/java/com/yourproject/`.
118
+
119
+	```java
120
+	import com.reactnativenavigation.NavigationActivity;
121
+
122
+	public class MainActivity extends NavigationActivity {
123
+
124
+	}
125
+	```
126
+
127
+	If you have any **react-native** related methods, you can safely delete them.
128
+
129
+7. In `MainApplication.java`, add the following
130
+	
131
+	```java
132
+	import com.reactnativenavigation.NavigationApplication;
133
+
134
+	public class MainApplication extends NavigationApplication {
135
+		@Override
136
+		public boolean isDebug() {
137
+			return BuildConfig.DEBUG;
138
+		}
139
+
140
+		@Override
141
+		public List<ReactPackage> createAdditionalReactPackages() {
142
+			return Arrays.<ReactPackage>asList(
143
+				// eg. new VectorIconsPackage()
144
+			);
145
+		}
146
+ 	}
147
+	```
148
+    Make sure that `isDebug` method is implemented.
149
+
150
+8. Update `AndroidManifest.xml` and set `application` **android:name** value to `.MainApplication`
151
+	
152
+	```xml
153
+	<application
154
+		android:name=".MainApplication"
155
+		...
156
+	/>
157
+	```

+ 0
- 167
docs/docs/Navigation.md View File

@@ -1,167 +0,0 @@
1
-<a name="Navigation"></a>
2
-
3
-# Navigation
4
-
5
-* [Navigation](#Navigation)
6
-    * [.registerComponent(componentName, getComponentFunc)](#Navigation+registerComponent)
7
-    * [.setRoot(root)](#Navigation+setRoot)
8
-    * [.setDefaultOptions(options)](#Navigation+setDefaultOptions)
9
-    * [.setOptions(componentId, options)](#Navigation+setOptions)
10
-    * [.showModal(params)](#Navigation+showModal)
11
-    * [.dismissModal(componentId)](#Navigation+dismissModal)
12
-    * [.dismissAllModals()](#Navigation+dismissAllModals)
13
-    * [.push(componentId, component)](#Navigation+push)
14
-    * [.pop(componentId, params)](#Navigation+pop)
15
-    * [.popTo(componentId)](#Navigation+popTo)
16
-    * [.popToRoot(componentId)](#Navigation+popToRoot)
17
-    * [.events()](#Navigation+events)
18
-
19
-
20
-* * *
21
-
22
-<a name="Navigation+registerComponent"></a>
23
-
24
-## navigation.registerComponent(componentName, getComponentFunc)
25
-Every screen component in your app must be registered with a unique name. The component itself is a traditional React component extending React.Component.
26
-
27
-
28
-| Param | Type | Description |
29
-| --- | --- | --- |
30
-| componentName | <code>string</code> | Unique component name |
31
-| getComponentFunc | <code>function</code> | generator function, typically `() => require('./myComponent')` |
32
-
33
-
34
-* * *
35
-
36
-<a name="Navigation+setRoot"></a>
37
-
38
-## navigation.setRoot(root)
39
-Reset the navigation stack to a new screen (the stack root is changed).
40
-
41
-
42
-| Param | Type |
43
-| --- | --- |
44
-| root | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/Root">Root</a> |
45
-
46
-
47
-* * *
48
-
49
-<a name="Navigation+setDefaultOptions"></a>
50
-
51
-## navigation.setDefaultOptions(options)
52
-Set default options to all screens. Useful for declaring a consistent style across the app.
53
-
54
-
55
-| Param | Type |
56
-| --- | --- |
57
-| options | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/options/NavigationOptions">NavigationOptions</a> |
58
-
59
-
60
-* * *
61
-
62
-<a name="Navigation+setOptions"></a>
63
-
64
-## navigation.setOptions(componentId, options)
65
-Change a components navigation options
66
-
67
-
68
-| Param | Type | Description |
69
-| --- | --- | --- |
70
-| componentId | <code>string</code> | The component's id. |
71
-| options | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/options/NavigationOptions">NavigationOptions</a> |  |
72
-
73
-
74
-* * *
75
-
76
-<a name="Navigation+showModal"></a>
77
-
78
-## navigation.showModal(params)
79
-Show a screen as a modal.
80
-
81
-
82
-| Param | Type |
83
-| --- | --- |
84
-| params | <code>object</code> |
85
-
86
-
87
-* * *
88
-
89
-<a name="Navigation+dismissModal"></a>
90
-
91
-## navigation.dismissModal(componentId)
92
-Dismiss a modal by componentId. The dismissed modal can be anywhere in the stack.
93
-
94
-
95
-| Param | Type | Description |
96
-| --- | --- | --- |
97
-| componentId | <code>string</code> | The component's id. |
98
-
99
-
100
-* * *
101
-
102
-<a name="Navigation+dismissAllModals"></a>
103
-
104
-## navigation.dismissAllModals()
105
-Dismiss all Modals
106
-
107
-
108
-* * *
109
-
110
-<a name="Navigation+push"></a>
111
-
112
-## navigation.push(componentId, component)
113
-Push a new screen into this screen's navigation stack.
114
-
115
-
116
-| Param | Type | Description |
117
-| --- | --- | --- |
118
-| componentId | <code>string</code> | The component's id. |
119
-| component | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/Component">Component</a> |  |
120
-
121
-
122
-* * *
123
-
124
-<a name="Navigation+pop"></a>
125
-
126
-## navigation.pop(componentId, params)
127
-Pop a component from the stack, regardless of it's position.
128
-
129
-
130
-| Param | Type | Description |
131
-| --- | --- | --- |
132
-| componentId | <code>string</code> | The component's id. |
133
-| params | <code>*</code> |  |
134
-
135
-
136
-* * *
137
-
138
-<a name="Navigation+popTo"></a>
139
-
140
-## navigation.popTo(componentId)
141
-Pop the stack to a given component
142
-
143
-
144
-| Param | Type | Description |
145
-| --- | --- | --- |
146
-| componentId | <code>string</code> | The component's id. |
147
-
148
-
149
-* * *
150
-
151
-<a name="Navigation+popToRoot"></a>
152
-
153
-## navigation.popToRoot(componentId)
154
-Pop the component's stack to root.
155
-
156
-
157
-| Param | Type |
158
-| --- | --- |
159
-| componentId | <code>*</code> |
160
-
161
-
162
-* * *
163
-
164
-<a name="Navigation+events"></a>
165
-
166
-## navigation.events()
167
-Obtain the events registery instance

+ 0
- 10
docs/docs/Root.md View File

@@ -1,10 +0,0 @@
1
-<h1>Root</h1>
2
-
3
-**Properties**
4
-
5
-| Name | Type |
6
-| --- | --- |
7
-| component | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/Component">Component</a> | 
8
-| sideMenu | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/SideMenu">SideMenu</a> | 
9
-| bottomTabs | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/Component">Component[]</a> | 
10
-

+ 0
- 10
docs/docs/SideMenu.md View File

@@ -1,10 +0,0 @@
1
-<h1>SideMenu</h1>
2
-
3
-**Properties**
4
-
5
-| Name | Type |
6
-| --- | --- |
7
-| left | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/Component">Component</a> | 
8
-| center | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/Component">Component</a> | 
9
-| right | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/Component">Component</a> | 
10
-

+ 0
- 2
docs/docs/UPDATING.md View File

@@ -1,2 +0,0 @@
1
-# V1 to V2 - Whats missing? (WIP)
2
-

+ 219
- 0
docs/docs/Usage.md View File

@@ -0,0 +1,219 @@
1
+
2
+# Usage
3
+
4
+- If you don't like reading, just jump into the fully working [playground](https://github.com/wix/react-native-navigation/tree/v2/playground) project. All feature are implemented there and it's the basis for the e2e tests.
5
+- We fully support redux, mobx and other state management libraries. See the integration tests [here](https://github.com/wix/react-native-navigation/tree/v2/integration).
6
+- Navigation is written with `TypeScript` and shipped with the type definitions alongside the transpiled JS code. Use an IDE that supports it like VSCode or Webstorm to enjoy API autocompletion.
7
+- Take a loot at this excellent showcase app [JuneDomingo/movieapp](https://github.com/JuneDomingo/movieapp). (using v1 of React Native Navigation with redux).
8
+
9
+## The Basics
10
+
11
+### Navigation
12
+```js
13
+import { Navigation } from 'react-native-navigation';
14
+```
15
+
16
+### registerComponent(screenID, generator)
17
+Every screen component in your app must be registered with a unique name. The component itself is a traditional React component extending `React.Component` or `React.PureComponent`. It can also be a HOC to provide context (or provide a redux store). Similar to ReactNative's `AppRegistry.registerComponent`.
18
+
19
+```js
20
+Navigation.registerComponent(`navigation.playground.WelcomeScreen`, () => WelcomeScreen);
21
+```
22
+
23
+
24
+### onAppLaunched(callback)
25
+This event is called once the app is launched. Initialise the app with the layout you want. This creates the native layout hierarchy, loads the react components into the `component` by name, after which the app is ready for user interaction.
26
+
27
+```js
28
+Navigation.events().onAppLaunched(() => {
29
+  Navigation.setRoot({
30
+    component: {
31
+      name: 'navigation.playground.WelcomeScreen'
32
+    }
33
+  });
34
+});
35
+```
36
+
37
+## Layout Examples
38
+
39
+The layout api is completely open in terms of what you can construct with it.
40
+
41
+You can compose arbitrary native layout hierarchies, although some weird edge cases may not be possible or produce errors. In such cases, open an issue so that we either fix it or warn in dev time.
42
+
43
+
44
+For all layout types see [API](/api/README).
45
+
46
+
47
+### Single page app with two side menus:
48
+
49
+```js
50
+Navigation.setRoot({
51
+  sideMenu: {
52
+    left: {
53
+      component: {
54
+        name: 'navigation.playground.TextScreen',
55
+        passProps: {
56
+          text: 'This is a left side menu screen'
57
+        }
58
+      }
59
+    },
60
+    center: {
61
+      component: {
62
+        name: 'navigation.playground.WelcomeScreen'
63
+      },
64
+    },
65
+    right: {
66
+      component: {
67
+        name: 'navigation.playground.TextScreen',
68
+        passProps: {
69
+          text: 'This is a right side menu screen'
70
+        }
71
+      }
72
+    }
73
+  }
74
+});
75
+```
76
+
77
+### Tab based app (with passProps example):
78
+
79
+```js
80
+Navigation.setRoot({
81
+  bottomTabs: {
82
+    children: [
83
+      {
84
+        component: {
85
+          name: 'navigation.playground.TextScreen',
86
+          passProps: {
87
+            text: 'This is tab 1',
88
+            myFunction: () => 'Hello from a function!',
89
+          },
90
+        },
91
+      },
92
+      {
93
+        component: {
94
+          name: 'navigation.playground.TextScreen',
95
+          passProps: {
96
+            text: 'This is tab 2',
97
+          },
98
+        },
99
+      },
100
+    ],
101
+  },
102
+});
103
+```
104
+
105
+### Stack based app (with options example, initialised with 2 screens):
106
+
107
+```js
108
+Navigation.setRoot({
109
+  stack: {
110
+    options: {
111
+      topBar: {
112
+        hidden: true,
113
+      },
114
+    },
115
+    children: [
116
+      {
117
+        component: {
118
+          name: 'navigation.playground.TextScreen',
119
+          passProps: {
120
+            text: 'This is tab 1',
121
+            myFunction: () => 'Hello from a function!',
122
+          },
123
+        },
124
+      },
125
+      {
126
+        component: {
127
+          name: 'navigation.playground.TextScreen',
128
+          passProps: {
129
+            text: 'This is tab 2',
130
+          },
131
+        },
132
+      },
133
+    ],
134
+  },
135
+});
136
+```
137
+
138
+## Navigating The Stack
139
+
140
+For all commands see [API](/api/README).
141
+
142
+### push
143
+Push a new instance of a screen (component) on top of `this` screen's navigation stack.
144
+
145
+```js
146
+Navigation.push(this.props.componentId, {
147
+  component: {
148
+    name: 'navigation.playground.PushedScreen'
149
+  }
150
+});
151
+```
152
+
153
+### pop
154
+Pop the top screen from `this` screen's navigation stack.
155
+
156
+```js
157
+Navigation.pop(this.props.componentId);
158
+```
159
+
160
+### showModal
161
+Show a screen as a modal. (not part of the stack)
162
+
163
+```js
164
+Navigation.showModal({
165
+  component: {
166
+    name: 'navigation.playground.ModalScreen'
167
+  }
168
+});
169
+```
170
+### dismissModal
171
+Dismiss modal.
172
+
173
+```js
174
+Navigation.dismissModal(this.props.componentId);
175
+```
176
+
177
+## Screen Lifecycle
178
+
179
+The `didAppear` and `didDisappear` functions are lifecycle callbacks that are called by React Native Navigation on the component when it appears and disappears. 
180
+
181
+These are similar to react's `componentDidMount` and `componentWillUnmount` but are related to the actual visibility of a component to the user. While the component is `mounted` as soon as it's part of a layout, it is not always `visible` (for example when another screen is `pushed` on top of it), and therefore some performance optimizations measures are taken by React Native Navigation.
182
+
183
+They are also useful for a lot of use cases, for example starting and stopping an animation while the component is shown onscreen.
184
+
185
+> They are implemented by iOS's viewDidAppear/viewDidDisappear and Android's ViewTreeObserver visibility detection
186
+
187
+To use them simply implement them in your component like any other react lifecycle function:
188
+
189
+```js
190
+class LifecycleScreenExample extends Component {
191
+  constructor(props) {
192
+    super(props);
193
+    this.state = {
194
+      text: 'nothing yet'
195
+    };
196
+  }
197
+
198
+  didAppear() {
199
+    this.setState({ text: 'didAppear' });
200
+  }
201
+
202
+  didDisappear() {
203
+    alert('didDisappear');
204
+  }
205
+
206
+  componentWillUnmount() {
207
+    alert('componentWillUnmount');
208
+  }
209
+
210
+  render() {
211
+    return (
212
+      <View style={styles.root}>
213
+        <Text style={styles.h1}>{`Lifecycle Screen`}</Text>
214
+	      <Text style={styles.h1}>{this.state.text}</Text>
215
+      </View>
216
+    );
217
+  }
218
+}
219
+```

docs/docs/CONTRIBUTING.md → docs/docs/WorkingLocally.md View File

@@ -1,82 +1,29 @@
1
-# Contributing
1
+# Working Locally
2 2
 
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.
3
+> Thanks for your interest in helping out! We'd love your contributions, and there's plenty of work to be done regardless of your skill level
4 4
 
5 5
 ## Environment Requirements
6 6
 
7 7
 * Mac OSX
8
-* Latest stable XCode
9
-* Latest stable Node:
10
-
11
-```
12
-curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
13
-export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
14
-nvm install stable
15
-nvm use stable
16
-```
17
-
18
-* Android SDK:
19
-
20
-```
21
-export ANDROID_HOME=$HOME/android-sdk-macosx
22
-export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
23
-
24
-# fix for https://code.google.com/p/android/issues/detail?id=223424
25
-mkdir -p ~/.android
26
-
27
-# download android SDK
28
-echo "Downloading Android SDK"
29
-curl --location https://dl.google.com/android/android-sdk_r24.4.1-macosx.zip | tar -x -z -C $HOME
30
-```
31
-
8
+* [Latest stable Xcode](https://developer.apple.com/xcode/)
9
+* [Android SDK](https://developer.android.com/studio/index.html)
10
+* [Node 8+](https://nodejs.org/en/)
32 11
 * [AppleSimulatorUtils](https://github.com/wix/AppleSimulatorUtils)
33 12
 
34
-```
35
-brew tap wix/brew
36
-brew install --HEAD applesimutils
37
-```
38
-
39
-## Basics - Getting Started
13
+## Running The Project
40 14
 
41 15
 Got your environment set up? Go ahead and clone the repo. (Fork it first so you can open a PR when you're ready.)
42 16
 
43 17
 Then:
44 18
 
45
-1. Install dependencies:
46
-
47
-    ```
48
-    npm install
49
-    ```
50
-
51
-1. Run the playground project in Android and iOS so that you can get a feel for the project.
52
-
53
-    1. `npm run start` to get the package running in a terminal, leave it open
54
-
55
-    1. iOS: `npm run xcode` & run the project from XCode
56
-
57
-    1. Android: Open the app in Android Studio and click `Run`
58
-
59
-1. Run the tests. Before you start changing things, make sure everything works.
60
-
61
-     ```
62
-     npm run test-all
63
-     ```
19
+1. Install dependencies `npm install`
20
+2. Run the playground project in Android and iOS so that you can get a feel for the project.
21
+    - `npm run start` to get the packager running in a terminal, leave it open
22
+    - **iOS**: `npm run xcode` & run the project from Xcode
23
+    - **Android**: `npm run install-android`, or open the app in Android Studio and click `Run`
24
+3. Run the tests (using the scripts below). Before you start changing things, make sure everything works.
25
+	- To easily run all tests in parallel `npm run test-all`
64 26
 
65
-## Troubleshooting
66
-
67
-* If the tests fail with an error like `Ineligible destinations for the "ReactNativeNavigation" scheme`, double check that you have the latest XCode installed.
68
-* 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.
69
-* If the tests fail with an error such as:
70
-
71
-```js
72
-
73
- beforeEach(async () => {
74
-                   ^
75
-SyntaxError: Unexpected token (
76
-
77
-```
78
-
79
-You probably have an old node version which doesn't support async functions. Update your node using nvm according to the instructions above.
80 27
 
81 28
 ## Workflow
82 29
 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.
@@ -97,8 +44,8 @@ No PR will be accepted without adequate test coverage.
97 44
 | `lib/dist/index.js` | the entry point for `import Navigation from 'react-native-navigation'` |
98 45
 | `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) |
99 46
 | `AndroidE2E` | Android e2e tests using native uiautomator (until detox for android is ready) |
100
-| `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. |
101
-| `integration` | misc javascript integration tests |
47
+| `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` for faster local development (no need to `npm install` locally). |
48
+| `integration` | misc javascript integration tests, proving integration with other libraries like redux |
102 49
 | `scripts` | all scripts |
103 50
 
104 51
 ## Scripts
@@ -118,4 +65,20 @@ No PR will be accepted without adequate test coverage.
118 65
 | `npm run test-e2e-ios` | runs the ios e2e suite (with detox) in debug/release <br> **Options:** `-- --release`|
119 66
 | `npm run test-e2e-android` | runs the android e2e suite (with uiautomator) in debug/release on running devices/emulators <br> **Options:** `-- [--release] [--just com.TestClass#testMethod]` |
120 67
 | `npm run test-all` | runs all tests in parallel |
68
+| `npm run gen-docs` | generates api docs |
69
+| `npm run local-docs` | serve the docs locally for `http://localhost:3000/` |
70
+
71
+## Common Problems
72
+
73
+* If the tests fail with an error like `Ineligible destinations for the "ReactNativeNavigation" scheme`, double check that you have the latest XCode installed.
74
+* 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.
75
+* If the tests fail with an error such as:
76
+		
77
+	```js
78
+	 beforeEach(async () => {
79
+	                   ^
80
+	SyntaxError: Unexpected token (
81
+	```
82
+		
83
+	You probably have an old node version which doesn't support async functions. Update your nodejs to 8+.
121 84
 

+ 0
- 138
docs/docs/installation-android.md View File

@@ -1,138 +0,0 @@
1
-# Android Installation
2
-
3
-!> Make sure your Android Studio installation is updated. We recommend editing `gralde` and `java` files in Android Studio as the ide will suggest fixes and point out errors, this way you avoid most common pitfalls.
4
-
5
-
6
-1. Install `react-native-navigation` latest stable version.
7
-
8
-	```sh
9
-	yarn add react-native-navigation@alpha
10
-	```
11
-
12
-2. Add the following in `android/settings.gradle`.
13
-
14
-	```groovy
15
-	include ':react-native-navigation'
16
-	project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app/')
17
-	```
18
-	
19
-3. Update `android/build.gradle`
20
-
21
-	```diff
22
-	buildscript {
23
-	    repositories {
24
-	+        mavenLocal()
25
-	+        mavenCentral()
26
-	+        google()
27
-	+        jcenter()
28
-	    }
29
-	    dependencies {
30
-	+        classpath 'com.android.tools.build:gradle:3.0.1'
31
-	-        classpath 'com.android.tools.build:gradle:2.2.3'
32
-	    }
33
-	}
34
-	
35
-	allprojects {
36
-	    repositories {
37
-	        mavenLocal()
38
-	+        mavenCentral()
39
-	+        google()
40
-	        jcenter()
41
-	        maven {
42
-	            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
43
-	            url "$rootDir/../../node_modules/react-native/android"
44
-	        }
45
-	    }
46
-	}
47
-	```
48
-
49
-4. Update project dependencies in `android/app/build.gradle`.
50
-
51
-	```groovy
52
-	android {
53
-	    compileSdkVersion 25
54
-	    buildToolsVersion "27.0.3"
55
-	    
56
-	    defaultConfig {
57
-	        minSdkVersion 19
58
-	        targetSdkVersion 25
59
-		...
60
-	    }
61
-	
62
-	    compileOptions {
63
-	        sourceCompatibility JavaVersion.VERSION_1_8
64
-	        targetCompatibility JavaVersion.VERSION_1_8
65
-	    }
66
-	    ...
67
-	}
68
-	
69
-	dependencies {
70
-	    implementation fileTree(dir: "libs", include: ["*.jar"])
71
-	    implementation "com.android.support:appcompat-v7:25.4.0"
72
-	    implementation "com.facebook.react:react-native:+"
73
-	    implementation project(':react-native-navigation')
74
-	}
75
-	```
76
-	
77
-5. Make sure you're using the new gradle plugin, edit `android/gradle/wrapper/gradle-wrapper.properties`
78
-
79
-	```diff
80
-	distributionBase=GRADLE_USER_HOME
81
-	distributionPath=wrapper/dists
82
-	zipStoreBase=GRADLE_USER_HOME
83
-	zipStorePath=wrapper/dists
84
-	+distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
85
-	-distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
86
-	```
87
-
88
-6. Update `gradle.properties` and disable incremental resource processing
89
-
90
-	```diff
91
-	+# Disable incremental resource processing as it broke relase build
92
-	+android.enableAapt2=false
93
-	```
94
-
95
-7. In `MainActivity.java` it should extend `com.reactnativenavigation.NavigationActivity` instead of `ReactActivity`.
96
-
97
-	This file can be located in `android/app/src/main/java/com/yourproject/`.
98
-
99
-	```java
100
-	import com.reactnativenavigation.NavigationActivity;
101
-
102
-	public class MainActivity extends NavigationActivity {
103
-
104
-	}
105
-	```
106
-
107
-	If you have any **react-native** related methods, you can safely delete them.
108
-
109
-8. In `MainApplication.java`, add the following
110
-	
111
-	```java
112
-	import com.reactnativenavigation.NavigationApplication;
113
-
114
-	public class MainApplication extends NavigationApplication {
115
-     @Override
116
-	public boolean isDebug() {
117
-		return BuildConfig.DEBUG;
118
-	}
119
-
120
-	@Override
121
-	public List<ReactPackage> createAdditionalReactPackages() {
122
-		return Arrays.<ReactPackage>asList(
123
-			// eg. new VectorIconsPackage()
124
-		);
125
-	}
126
- 	}
127
-	```
128
-
129
-	Make sure that `isDebug` methods is implemented.
130
-
131
-9. Update `AndroidManifest.xml` and set **android:name** value to `.MainApplication`
132
-	
133
-	```xml
134
-	<application
135
-		android:name=".MainApplication"
136
-		...
137
-	/>
138
-	```

+ 0
- 26
docs/docs/installation-ios.md View File

@@ -1,26 +0,0 @@
1
-# iOS Installation
2
-
3
-1. Install `react-native-navigation` latest stable version.
4
-
5
-    ```sh
6
-    npm install --save react-native-navigation@alpha
7
-    ```
8
-
9
-2. In Xcode, in Project Navigator (left pane), right-click on the `Libraries` > `Add files to [project name]`. Add `./node_modules/react-native-navigation/lib/ios/ReactNativeNavigation.xcodeproj` ([screenshots](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#step-1))
10
-
11
-3. In Xcode, in Project Navigator (left pane), click on your project (top) and select the `Build Phases` tab (right pane). In the `Link Binary With Libraries` section add `libReactNativeNavigation.a` ([screenshots](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#step-2))
12
-
13
-4. In Xcode, in Project Navigator (left pane), click on your project (top) and select the `Build Settings` tab (right pane). In the `Header Search Paths` section add `$(SRCROOT)/../node_modules/react-native-navigation/lib/ios`. Make sure on the right to mark this new path `recursive` ([screenshots](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#step-3))
14
-
15
-5. In Xcode, under your project files, modify `AppDelegate.m`. add:
16
-
17
-`#import <ReactNativeNavigation/ReactNativeNavigation.h>`
18
-
19
-remove everything in the method didFinishLaunchingWithOptions and add:
20
-
21
-```
22
-NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
23
-[ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
24
-
25
-return YES;
26
-```

+ 0
- 13
docs/docs/options/BottomTab.md View File

@@ -1,13 +0,0 @@
1
-<h1>BottomTab</h1>
2
-
3
-**Properties**
4
-
5
-| Name | Type |
6
-| --- | --- |
7
-| title | <code>string</code> | 
8
-| tag | <code>number</code> | 
9
-| icon | <code>object</code> | 
10
-| visible | <code>boolean</code> | 
11
-| badge | <code>string</code> | 
12
-| testID | <code>string</code> | 
13
-

+ 0
- 13
docs/docs/options/BottomTabs.md View File

@@ -1,13 +0,0 @@
1
-<h1>BottomTabs</h1>
2
-
3
-**Properties**
4
-
5
-| Name | Type |
6
-| --- | --- |
7
-| currentTabId | <code>string</code> | 
8
-| currentTabIndex | <code>number</code> | 
9
-| hidden | <code>boolean</code> | 
10
-| animate | <code>boolean</code> | 
11
-| testID | <code>string</code> | 
12
-| drawUnder | <code>boolean</code> | 
13
-

+ 0
- 15
docs/docs/options/Button.md View File

@@ -1,15 +0,0 @@
1
-<h1>Button</h1>
2
-
3
-**Properties**
4
-
5
-| Name | Type |
6
-| --- | --- |
7
-| id | <code>string</code> | 
8
-| testID | <code>string</code> | 
9
-| title | <code>string</code> | 
10
-| buttonColor | <code>string</code> | 
11
-| showAsAction | <code>string</code> | 
12
-| buttonFontWeight | <code>int</code> | 
13
-| disableIconTint | <code>boolean</code> | 
14
-| disabled | <code>boolean</code> | 
15
-

+ 0
- 14
docs/docs/options/NavigationOptions.md View File

@@ -1,14 +0,0 @@
1
-<h1>NavigationOptions</h1>
2
-
3
-**Properties**
4
-
5
-| Name | Type |
6
-| --- | --- |
7
-| topBar | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/options/TopBar">TopBar</a> | 
8
-| bottomTabs | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/options/BottomTabs">BottomTabs</a> | 
9
-| bottomTab | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/options/BottomTab">BottomTab</a> | 
10
-| orientation | <code>string</code> | 
11
-| topTabs | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/options/TopTabs">TopTabs</a> | 
12
-| rightButtons | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/options/Button">Button[]</a> | 
13
-| leftButtons | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/options/Button">Button[]</a> | 
14
-

+ 0
- 23
docs/docs/options/TopBar.md View File

@@ -1,23 +0,0 @@
1
-<h1>TopBar</h1>
2
-
3
-**Properties**
4
-
5
-| Name | Type |
6
-| --- | --- |
7
-| title | <code>string</code> | 
8
-| backgroundColor | <code>string</code> | 
9
-| textColor | <code>string</code> | 
10
-| buttonColor | <code>string</code> | 
11
-| textFontSize | <code>number</code> | 
12
-| textFontFamily | <code>string</code> | 
13
-| testID | <code>string</code> | 
14
-| hidden | <code>boolean</code> | 
15
-| animate | <code>boolean</code> | 
16
-| hideOnScroll | <code>boolean</code> | 
17
-| transparent | <code>boolean</code> | 
18
-| translucent | <code>boolean</code> | 
19
-| blur | <code>boolean</code> | 
20
-| noBorder | <code>boolean</code> | 
21
-| largeTitle | <code>boolean</code> | 
22
-| drawUnder | <code>boolean</code> | 
23
-

+ 0
- 9
docs/docs/options/TopTab.md View File

@@ -1,9 +0,0 @@
1
-<h1>TopTab</h1>
2
-
3
-**Properties**
4
-
5
-| Name | Type | Description |
6
-| --- | --- | --- |
7
-| title | <code>string</code> | The tab's title in the TopTabs view |
8
-| titleFontFamily | <code>string</code> | Change the tab's title font family |
9
-

+ 0
- 10
docs/docs/options/TopTabs.md View File

@@ -1,10 +0,0 @@
1
-<h1>TopTabs</h1>
2
-
3
-**Properties**
4
-
5
-| Name | Type | Description |
6
-| --- | --- | --- |
7
-| selectedTabColor | <code>string</code> | Selected tab color |
8
-| unselectedTabColor | <code>string</code> | Unselected tab color |
9
-| fontSize | <code>int</code> |  |
10
-

+ 0
- 206
docs/docs/usage.md View File

@@ -1,206 +0,0 @@
1
-# Usage
2
-
3
-## Top Screen API
4
-
5
-### Navigation
6
-```js
7
-import { Navigation } from 'react-native-navigation';
8
-```
9
-### Events - On App Launched
10
-How to initiate your app.
11
-
12
-```js
13
-Navigation.events().onAppLaunched(() => {
14
-  Navigation.setRoot({
15
-    component: {
16
-      name: 'navigation.playground.WelcomeScreen'
17
-    }
18
-  });
19
-});
20
-```
21
-
22
-### registerComponent(screenID, generator)
23
-Every screen component in your app must be registered with a unique name. The component itself is a traditional React component extending React.Component.
24
-
25
-```js
26
-Navigation.registerComponent(`navigation.playground.WelcomeScreen`, () => WelcomeScreen);
27
-```
28
-
29
-### setRoot({params})
30
-Start a Single page app with two side menus:
31
-
32
-```js
33
-Navigation.setRoot({
34
-  sideMenu: {
35
-    left: {
36
-      component: {
37
-        name: 'navigation.playground.TextScreen',
38
-        passProps: {
39
-          text: 'This is a left side menu screen'
40
-        }
41
-      }
42
-    },
43
-    center: {
44
-      component: {
45
-        name: 'navigation.playground.WelcomeScreen'
46
-      },
47
-    },
48
-    right: {
49
-      component: {
50
-        name: 'navigation.playground.TextScreen',
51
-        passProps: {
52
-          text: 'This is a right side menu screen'
53
-        }
54
-      }
55
-    }
56
-  }
57
-});
58
-```
59
-Start a tab based app:
60
-
61
-```js
62
-Navigation.setRoot({
63
-  bottomTabs: {
64
-    children: [
65
-      {
66
-        component: {
67
-          name: 'navigation.playground.TextScreen',
68
-          passProps: {
69
-            text: 'This is tab 1',
70
-            myFunction: () => 'Hello from a function!',
71
-          },
72
-        },
73
-      },
74
-      {
75
-        component: {
76
-          name: 'navigation.playground.TextScreen',
77
-          passProps: {
78
-            text: 'This is tab 2',
79
-          },
80
-        },
81
-      },
82
-    ],
83
-  },
84
-});
85
-```
86
-
87
-Start a stack based app (with options):
88
-
89
-```js
90
-Navigation.setRoot({
91
-  stack: {
92
-    options: {
93
-      topBar: {
94
-        hidden: true,
95
-      },
96
-    },
97
-    children: [
98
-      {
99
-        component: {
100
-          name: 'navigation.playground.TextScreen',
101
-          passProps: {
102
-            text: 'This is tab 1',
103
-            myFunction: () => 'Hello from a function!',
104
-          },
105
-        },
106
-      },
107
-      {
108
-        component: {
109
-          name: 'navigation.playground.TextScreen',
110
-          passProps: {
111
-            text: 'This is tab 2',
112
-          },
113
-        },
114
-      },
115
-    ],
116
-  },
117
-});
118
-```
119
-## Screen API
120
-
121
-### push(params)
122
-Push a new screen into this screen's navigation stack.
123
-
124
-```js
125
-Navigation.push(this.props.componentId, {
126
-  component: {
127
-    name: 'navigation.playground.PushedScreen',
128
-    passProps: {}
129
-  }
130
-});
131
-```
132
-### pop(componentId)
133
-Pop the top screen from this screen's navigation stack.
134
-
135
-```js
136
-Navigation.pop(this.props.componentId);
137
-```
138
-### popTo(componentId)
139
-```js
140
-Navigation.popTo(previousScreenId);
141
-```
142
-### popToRoot()
143
-Pop all the screens until the root from this screen's navigation stack
144
-
145
-```js
146
-Navigation.popToRoot(this.props.componentId);
147
-```
148
-### showModal(params = {})
149
-Show a screen as a modal.
150
-
151
-```js
152
-Navigation.showModal({
153
-  component: {
154
-    name: 'navigation.playground.ModalScreen',
155
-    passProps: {
156
-        key: 'value'
157
-    }
158
-  }
159
-});
160
-```
161
-### dismissModal(componentId)
162
-Dismiss modal.
163
-
164
-```js
165
-Navigation.dismissModal(this.props.componentId);
166
-```
167
-### dismissAllModals()
168
-Dismiss all the current modals at the same time.
169
-```js
170
-Navigation.dismissAllModals();
171
-```
172
-### Screen Lifecycle - didDisappear() and didAppear()
173
-
174
-The didDisappear() and didAppear() functions are lifecycle functions that are added to the screen and run when a screen apears and disappears from the screen. To use them simply add them to your component like any other react lifecycle function:
175
-
176
-```js
177
-class LifecycleScreen extends Component {
178
-  constructor(props) {
179
-    super(props);
180
-    this.state = {
181
-      text: 'nothing yet'
182
-    };
183
-  }
184
-
185
-  didAppear() {
186
-    this.setState({ text: 'didAppear' });
187
-  }
188
-
189
-  didDisappear() {
190
-    alert('didDisappear');
191
-  }
192
-
193
-  componentWillUnmount() {
194
-    alert('componentWillUnmount');
195
-  }
196
-
197
-  render() {
198
-    return (
199
-      <View style={styles.root}>
200
-        <Text style={styles.h1}>{`Lifecycle Screen`}</Text>
201
-	      <Text style={styles.h1}>{this.state.text}</Text>
202
-      </View>
203
-    );
204
-  }
205
-}
206
-```

+ 0
- 339
docs/docs/v1tov2diff.md View File

@@ -1,339 +0,0 @@
1
-#  React Native Navigation v2 (WIP)
2
-We are rebuilding react-native-navigation
3
-
4
-- [Why?](#why-rebuild-react-native-navigation)
5
-- [Where is it standing now?](#where-is-it-standing-now)
6
-- [Getting Started](#getting-started-with-v2)
7
-- [Usage](#usage)
8
-
9
-## Why Rebuild react-native-navigation?
10
-
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>
14
-* What if you want to update your navbar icons and the user pops the screen? Your icons might update on the wrong screen.
15
-* What if you want to push a screen as a result of a redux action?
16
-
17
-There are ways to solve some of these problems in v1 but they are not straightforward. We want to change that.
18
-
19
-#### New API
20
-To solve this problem in v2, every screen receives as a prop it’s componentId. Whenever you want to perform an action from that screen you need to pass the componentId to the function:
21
-```js
22
-Navigator.pop(this.props.componentId)
23
-```
24
-### Built for Contributors
25
-Currently, it requires a lot of work to accept pull requests. We need to manually make sure that everything works before we approve them because v1 is not thoroughly tested. <br>
26
-v2 is written with contributors in mind from day one.
27
-
28
-#### Written In TDD
29
-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
-
31
-
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):
35
-### Top Level API
36
-
37
-|    API              | v1  | v2 |
38
-|--------------------|-----|----|
39
-| startTabBasedApp   |   ✅    |   ✅  |
40
-| startSinglePageApp |   ✅   |  ✅   |
41
-| registerScreen     |   ✅   |  ✅   |
42
-| drawer             |    ✅  |    ✅ |
43
-### Screen API
44
-
45
-|  API              | v1     | v2         |
46
-|---------------------|--------|------------|
47
-| push                |  ✅     |   ✅       |
48
-| pop                 |  ✅     |  ✅        |
49
-| showModal           |  ✅     |  ✅        |
50
-| popToRoot           |   ✅     |   ✅         |
51
-| resetTo             |   ✅     |    ✅        |
52
-| dismissModal        |   ✅     |     ✅       |
53
-| dismissAllModals    |   ✅     |      ✅      |
54
-| showLightBox        |   ✅     |      [Contribute](CONTRIBUTING.md)      |
55
-| dismissLightBox     |   ✅     |       [Contribute](CONTRIBUTING.md)       |
56
-| handleDeepLink      |   ✅     |       [Contribute](CONTRIBUTING.md)       |
57
-| setOnNavigatorEvent |   ✅     |       [Contribute](CONTRIBUTING.md)       |
58
-| setButtons          |   ✅     |         [Contribute](CONTRIBUTING.md)     |
59
-| setTitle            |   ✅     |         [Contribute](CONTRIBUTING.md)     |
60
-| toggleDrawer        |   ✅     |        [Contribute](CONTRIBUTING.md)   |
61
-| toggleTabs          |   ✅     |        [Contribute](CONTRIBUTING.md)     |
62
-| setTabBadge         |    ✅    |       [Contribute](CONTRIBUTING.md)     |
63
-| switchToTab         |    ✅    |        [Contribute](CONTRIBUTING.md)    |
64
-| toggleNavBar        |   ✅     |      [Contribute](CONTRIBUTING.md)      |
65
-| Element tranisitions  |   ✅     |     [Contribute](CONTRIBUTING.md)       |
66
-| static styles   |   ✅     |       [Contribute](CONTRIBUTING.md)     |
67
-| dynamic styles   |   ✅     |       [Contribute](CONTRIBUTING.md)     |
68
-
69
-
70
-## Getting started with v2
71
-If v2 supports everything you need for your app we encourage you to use it.
72
-
73
-### Installation
74
-1. Download react-native-navigation v2
75
-```bash
76
-npm install --save react-native-navigation@alpha
77
-```
78
-##### iOS
79
-2. In Xcode, in Project Navigator (left pane), right-click on the `Libraries` > `Add files to [project name]`. Add `./node_modules/react-native-navigation/lib/ios/ReactNativeNavigation.xcodeproj` ([screenshots](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#step-1))
80
-
81
-3. In Xcode, in Project Navigator (left pane), click on your project (top) and select the `Build Phases` tab (right pane). In the `Link Binary With Libraries` section add `libReactNativeNavigation.a` ([screenshots](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#step-2))
82
-
83
-4. In Xcode, in Project Navigator (left pane), click on your project (top) and select the `Build Settings` tab (right pane). In the `Header Search Paths` section add `$(SRCROOT)/../node_modules/react-native-navigation/lib/ios`. Make sure on the right to mark this new path `recursive` ([screenshots](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#step-3))
84
-
85
-5. In Xcode, under your project files, modify `AppDelegate.m`. add:
86
-
87
-`#import <ReactNativeNavigation/ReactNativeNavigation.h>`
88
-
89
-remove everything in the method didFinishLaunchingWithOptions and add:
90
-
91
-```
92
-NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
93
-[ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
94
-```
95
-
96
-##### Android
97
-2. Add the following in `android/settings.gradle`.
98
-
99
-	```groovy
100
-	include ':react-native-navigation'
101
-	project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-	navigation/lib/android/app/')
102
-	```
103
-
104
-3. Update project dependencies in `android/app/build.gradle`.
105
-	```groovy
106
-	android {
107
-		compileSdkVersion 25
108
-		buildToolsVersion "25.0.1"
109
-		...
110
-	}
111
-
112
-	dependencies {
113
-		compile fileTree(dir: "libs", include: ["*.jar"])
114
-		compile "com.android.support:appcompat-v7:23.0.1"
115
-		compile "com.facebook.react:react-native:+"
116
-		compile project(':react-native-navigation')
117
-	}
118
-	```
119
-
120
-4. In `MainActivity.java` it should extend `com.reactnativenavigation.controllers.SplashActivity` instead of `ReactActivity`.
121
-
122
-	This file can be located in `android/app/src/main/java/com/yourproject/`.
123
-
124
-	```java
125
-	import com.reactnativenavigation.controllers.SplashActivity;
126
-
127
-	public class MainActivity extends SplashActivity {
128
-
129
-	}
130
-	```
131
-
132
-	If you have any **react-native** related methods, you can safely delete them.
133
-
134
-5. In `MainApplication.java`, add the following
135
-	```java
136
-	import com.reactnativenavigation.NavigationApplication;
137
-
138
-	public class MainApplication extends NavigationApplication {
139
-
140
-		@Override
141
-		public boolean isDebug() {
142
-			// Make sure you are using BuildConfig from your own application
143
-			return BuildConfig.DEBUG;
144
-		}
145
-
146
-		protected List<ReactPackage> getPackages() {
147
-			// Add additional packages you require here
148
-			// No need to add RnnPackage and MainReactPackage
149
-			return Arrays.<ReactPackage>asList(
150
-				// eg. new VectorIconsPackage()
151
-			);
152
-		}
153
-
154
-		@Override
155
-		public List<ReactPackage> createAdditionalReactPackages() {
156
-			return getPackages();
157
-		}
158
-	}
159
-	```
160
-
161
-	Make sure that `isDebug` and `createAdditionalReactPackages` methods are implemented.
162
-
163
-6. Update `AndroidManifest.xml` and set **android:name** value to `.MainApplication`
164
-	```xml
165
-	<application
166
-		android:name=".MainApplication"
167
-		...
168
-	/>
169
-## Usage
170
-### Top Screen API
171
-
172
-#### Navigation
173
-```js
174
-import Navigation from 'react-native-navigation';
175
-```
176
-#### Events - On App Launched
177
-How to initiate your app.
178
-
179
-```js
180
-Navigation.events().onAppLaunched(() => {
181
-    Navigation.setRoot({
182
-      component: {
183
-        name: 'navigation.playground.WelcomeScreen'
184
-      }
185
-    });
186
-  });
187
-```
188
-
189
-#### registerComponent(screenID, generator)
190
-Every screen component in your app must be registered with a unique name. The component itself is a traditional React component extending React.Component.
191
-
192
-```js
193
-Navigation.registerComponent(`navigation.playground.WelcomeScreen`, () => WelcomeScreen);
194
-```
195
-
196
-#### setRoot({params})
197
-Start a Single page app with two side menus:
198
-
199
-```js
200
-Navigation.setRoot({
201
-      component: {
202
-        name: 'navigation.playground.WelcomeScreen'
203
-      },
204
-      sideMenu: {
205
-        left: {
206
-          component: {
207
-            name: 'navigation.playground.TextScreen',
208
-            passProps: {
209
-              text: 'This is a left side menu screen'
210
-            }
211
-          }
212
-        },
213
-        right: {
214
-          component: {
215
-            name: 'navigation.playground.TextScreen',
216
-            passProps: {
217
-              text: 'This is a right side menu screen'
218
-            }
219
-          }
220
-        }
221
-      }
222
-    });
223
-```
224
-Start a tab based app:
225
-
226
-```js
227
-Navigation.setRoot({
228
-      tabs: [
229
-        {
230
-          component: {
231
-            name: 'navigation.playground.TextScreen',
232
-            passProps: {
233
-              text: 'This is tab 1',
234
-              myFunction: () => 'Hello from a function!'
235
-            }
236
-          }
237
-        },
238
-        {
239
-          component: {
240
-            name: 'navigation.playground.TextScreen',
241
-            passProps: {
242
-              text: 'This is tab 2'
243
-            }
244
-          }
245
-        }
246
-      ]
247
-    });
248
-```
249
-### Screen API
250
-
251
-#### push(params)
252
-Push a new screen into this screen's navigation stack.
253
-
254
-```js
255
-Navigation.push(this.props.componentId, {
256
-      name: 'navigation.playground.PushedScreen',
257
-      passProps: {}
258
-    });
259
-```
260
-#### pop(componentId)
261
-Pop the top screen from this screen's navigation stack.
262
-
263
-```js
264
-Navigation.pop(this.props.componentId);
265
-```
266
-#### popTo(params)
267
-
268
-```js
269
-Navigation.popTo(this.props.componentId, this.props.previousScreenIds[0]);
270
-```
271
-#### popToRoot()
272
-Pop all the screens until the root from this screen's navigation stack
273
-
274
-```js
275
-Navigation.popToRoot(this.props.componentId);
276
-```
277
-#### showModal(params = {})
278
-Show a screen as a modal.
279
-
280
-```js
281
-Navigation.showModal({
282
-      component: {
283
-        name: 'navigation.playground.ModalScreen',
284
-        passProps: {
285
-            key: 'value'
286
-        }
287
-      }
288
-    });
289
-```
290
-#### dismissModal(componentId)
291
-Dismiss modal.
292
-
293
-```js
294
-Navigation.dismissModal(this.props.componentId);
295
-```
296
-#### dismissAllModals()
297
-Dismiss all the current modals at the same time.
298
-
299
-```js
300
-Navigation.dismissAllModals();
301
-```
302
-#### Screen Lifecycle - didDisappear() and didAppear()
303
-
304
-The didDisappear() and didAppear() functions are lifecycle functions that are added to the screen and run when a screen apears and disappears from the screen. To use them simply add them to your component like any other react lifecycle function:
305
-
306
-```js
307
-class LifecycleScreen extends Component {
308
-  constructor(props) {
309
-    super(props);
310
-    this.state = {
311
-      text: 'nothing yet'
312
-    };
313
-  }
314
-
315
-  didAppear() {
316
-    this.setState({ text: 'didAppear' });
317
-  }
318
-
319
-  didDisappear() {
320
-    alert('didDisappear');
321
-  }
322
-
323
-  componentWillUnmount() {
324
-    alert('componentWillUnmount');
325
-  }
326
-
327
-  render() {
328
-    return (
329
-      <View style={styles.root}>
330
-        <Text style={styles.h1}>{`Lifecycle Screen`}</Text>
331
-	<Text style={styles.h1}>{this.state.text}</Text>
332
-      </View>
333
-    );
334
-  }
335
-}
336
-```
337
-
338
-
339
-

+ 45
- 49
docs/index.html View File

@@ -1,56 +1,52 @@
1 1
 <!DOCTYPE html>
2 2
 <html lang="en">
3
+
3 4
 <head>
4
-    <meta charset="UTF-8">
5
-    <title>React Native Navigation - truly native navigation for iOS and Android</title>
6
-    <meta name="description" content="React Native Navigation - truly native navigation for iOS and Android">
7
-    <meta name="viewport"
8
-          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
9
-    <link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
10
-    <link rel="shortcut icon" href="_images/favicon.ico" type="image/x-icon">
11
-    <link rel="icon" href="_images/favicon.ico" type="image/x-icon">
5
+  <meta charset="UTF-8">
6
+  <title>React Native Navigation - truly native navigation for iOS and Android</title>
7
+  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
8
+  <meta name="description" content="React Native Navigation - truly native navigation for iOS and Android">
9
+  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
10
+  <link rel="shortcut icon" href="_images/favicon.ico" type="image/x-icon">
11
+  <link rel="icon" href="_images/favicon.ico" type="image/x-icon">
12
+  <link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
13
+  <link rel="stylesheet" href="//unpkg.com/docsify-copy-code/styles.css">
12 14
 </head>
15
+
13 16
 <body>
14
-<div id="app">
15
-    <img src="https://raw.githubusercontent.com/wix/react-native-navigation/master/logo.png"
16
-         alt="react-native-navigation logo">
17
-</div>
18
-</body>
19
-<script>
17
+  <div id="app">Please wait...</div>
18
+  <script src="//unpkg.com/docsify-copy-code/index.js"></script>
19
+  <script>
20 20
     window.$docsify = {
21
-        repo: '',
22
-        name: 'React Native Navigation',
23
-        search: 'auto',
24
-        themeColor: '#21B8F0',
25
-        loadSidebar: true,
26
-        loadNavbar: true,
27
-        maxLevel: 4,
28
-        subMaxLevel: 2,
29
-        auto2top: true,
30
-        ga: 'UA-XXXXX-Y',
31
-        plugins: [
32
-            function (hook) {
33
-                var footer = [
34
-                    '<hr/>',
35
-                    '<footer class="Test">',
36
-                    `<span>Caught a mistake or want to contribute to the documentation? <a href="https://github.com/wix/react-native-navigation/tree/v2/docs" target="_blank">Edit documentation on Github!</a>.</span>`,
37
-                    '</footer>'
38
-                ].join('');
21
+      name: 'React Native Navigation',
22
+      repo: 'wix/react-native-navigation',
23
+      themeColor: '#21B8F0',
24
+      search: 'auto',
25
+      loadSidebar: true,
26
+      alias: {
27
+        '/.*/_sidebar.md': '/_sidebar.md'
28
+      },
29
+      subMaxLevel: 2,
30
+      auto2top: true,
31
+      plugins: [
32
+        window.DocsifyCopyCodePlugin.init()
33
+      ]
34
+    }
35
+  </script>
36
+  <script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
37
+  <script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
38
+  <script src="//unpkg.com/prismjs/components/prism-typescript.min.js"></script>
39
+  <script src="//unpkg.com/prismjs/components/prism-jsx.min.js"></script>
40
+  <script src="//unpkg.com/prismjs/components/prism-java.min.js"></script>
41
+  <script src="//unpkg.com/prismjs/components/prism-c.min.js"></script>
42
+  <script src="//unpkg.com/prismjs/components/prism-objectivec.min.js"></script>
43
+
44
+  <!-- this allows us to re-run docs even when offline -->
45
+  <script>
46
+    if (typeof navigator.serviceWorker !== 'undefined') {
47
+      navigator.serviceWorker.register('sw.js')
48
+    }
49
+  </script>
50
+</body>
39 51
 
40
-                hook.afterEach(function (html) {
41
-                    return html + footer;
42
-                });
43
-            }
44
-        ]
45
-    };
46
-</script>
47
-<script src="//unpkg.com/docsify/lib/docsify.js"></script>
48
-<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
49
-<script src="//unpkg.com/docsify/lib/plugins/emoji.js"></script>
50
-<script src="//unpkg.com/docsify/lib/plugins/ga.js"></script>
51
-<script>
52
-  if (typeof navigator.serviceWorker !== 'undefined') {
53
-    navigator.serviceWorker.register('sw.js')
54
-  }
55
-</script>
56
-</html>
52
+</html>

+ 0
- 9
docs/linkify.js View File

@@ -1,9 +0,0 @@
1
-const URL = 'https://wix.github.io/react-native-navigation/v2/#/docs/';
2
-const isLetter = (c) => c.toLowerCase() !== c.toUpperCase();
3
-const isClass = (type) => isLetter(type[0]) && (type.includes(':') || type[0] === type[0].toUpperCase());
4
-const stripArray = (type) => type.substring(type.indexOf('<') + 1, type.indexOf('>'));
5
-const classUrl = (type) => URL + (type.includes('Array.<') ? stripArray(type) : type).replace(':', '/');
6
-const className = (type) => type.includes('Array.<') ? className(stripArray(type)) + '[]' : type.substring(type.indexOf(':') + 1);
7
-const url = (type) => `<a href="${classUrl(type)}">${className(type)}</a>`;
8
-const simpleString = (type) => `<code>${type}</code>`;
9
-exports.linkify = (type) => isClass(type) ? url(type) : simpleString(type);

+ 0
- 1
docs/stringify.js View File

@@ -1 +0,0 @@
1
-exports.stringify = (obj) => JSON.stringify(obj);

+ 7
- 0
docs/templates/class.hbs View File

@@ -0,0 +1,7 @@
1
+# {{name}}
2
+
3
+## Methods
4
+
5
+{{#each methods}}
6
+{{> method}}
7
+{{/each}}

+ 0
- 5
docs/templates/docs.hbs View File

@@ -1,5 +0,0 @@
1
-{{>header~}}
2
-{{>body}}
3
-{{>member-index~}}
4
-{{#unless @last}}{{>separator~}}{{/unless}}
5
-{{~>members~}}

+ 0
- 3
docs/templates/header.hbs View File

@@ -1,3 +0,0 @@
1
-<h1>{{anchorName}}</h1>
2
-
3
-{{>sig-name}}

+ 0
- 25
docs/templates/link.hbs View File

@@ -1,25 +0,0 @@
1
-{{! usage: link to="namepath" html=true/false caption="optional caption"~}}
2
-
3
-{{~#if html~}}
4
-<code>
5
-
6
-{{~#link to~}}
7
-{{#if url~}}
8
-<a href="{{{url}}}">{{#if ../../caption}}{{../../../caption}}{{else}}{{name}}{{/if}}</a>
9
-{{~else~}}
10
-{{#if ../../caption}}{{../../../caption}}{{else}}{{name}}{{/if~}}
11
-{{/if~}}
12
-{{/link~}}
13
-
14
-</code>
15
-{{~else~}}
16
-
17
-{{#link to~}}
18
-{{#if url~}}
19
-[<code>{{#if ../../caption}}{{escape ../../../caption}}{{else}}{{escape name}}{{/if}}</code>]({{{url}}})
20
-{{~else~}}
21
-{{#if ../../caption}}<code>{{escape ../../../caption}}</code>{{else}}{{{linkify name}}}{{/if~}}
22
-{{~/if~}}
23
-{{/link~}}
24
-
25
-{{/if~}}

+ 0
- 4
docs/templates/linked-type-list.hbs View File

@@ -1,4 +0,0 @@
1
-{{#each types~}}
2
-{{>link to=this html=../html ~}}
3
-{{#unless @last}}{{{../../delimiter}}}{{/unless~}}
4
-{{/each}}

+ 1
- 0
docs/templates/main.hbs View File

@@ -0,0 +1 @@
1
+{{> class}}

+ 13
- 0
docs/templates/method.hbs View File

@@ -0,0 +1,13 @@
1
+### `{{name}}(arg0: x, arg1: y): {{returnValue}}`
2
+
3
+[source]({{source}})
4
+
5
+{{comment}}
6
+
7
+#### Arguments
8
+TBD
9
+
10
+#### Returns
11
+TBD
12
+
13
+---

+ 0
- 4
docs/templates/param-table-name.hbs View File

@@ -1,4 +0,0 @@
1
-{{#if optional}}[{{/if~}}
2
-{{#if variable}}...{{/if~}}
3
-{{{name}~}}
4
-{{#if optional}}]{{/if}}

+ 0
- 12
docs/templates/params-table.hbs View File

@@ -1,12 +0,0 @@
1
-{{#if params}}
2
-
3
-{{tableHead params "name|Param" "type|Type" "defaultvalue|Default" "description|Description" ~}}
4
-
5
-{{#tableRow params "name" "type" "defaultvalue" "description" ~}}
6
-| {{#if @col1}}{{>param-table-name}} | {{/if~}}
7
-{{#if @col2}}{{>linked-type-list types=type.names delimiter=" \| " }} | {{/if~}}
8
-{{#if @col3}}{{>defaultvalue}} | {{/if~}}
9
-{{#if @col4}}{{{stripNewlines (inlineLinks description)}}} |{{/if}}
10
-{{/tableRow}}
11
-
12
-{{/if}}

+ 0
- 0
docs/templates/scope.hbs View File


+ 0
- 14
docs/templates/sig-name.hbs View File

@@ -1,14 +0,0 @@
1
-{{#if virtual}}*{{/if}}{{#with (parentObject)}}{{#if virtual}}*{{/if~}}{{/with~}}
2
-{{#if name}}{{#sig~}}
3
-{{{@depOpen}~}}
4
-{{{@codeOpen}~}}
5
-{{#if @prefix}}{{@prefix}} {{/if~}}
6
-{{@parent~}}
7
-{{#if @methodSign}}{{#if (isEvent)}} {{@methodSign}}{{else}}{{@methodSign}}{{/if}}{{/if~}}
8
-{{{@codeClose}~}}
9
-{{#if @returnSymbol}} {{@returnSymbol}}{{/if~}}
10
-{{#if @returnTypes}} {{>linked-type-list types=@returnTypes delimiter=" \| " }}{{/if~}}
11
-{{#if @suffix}} {{@suffix}}{{/if~}}
12
-{{{@depClose}~}}
13
-{{~/sig}}{{/if~}}
14
-{{#if virtual}}*{{/if}}{{#with (parentObject)}}{{#if virtual}}*{{/if~}}{{/with~}}

+ 4
- 4
integration/env.test.js View File

@@ -1,19 +1,19 @@
1 1
 const _ = require('lodash');
2 2
 
3
-describe('test environment', () => {
4
-  it('handles object spread', () => {
3
+describe('testing that the environment is working properly', () => {
4
+  it('object spread', () => {
5 5
     const { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
6 6
     expect(x).toEqual(1);
7 7
     expect(y).toEqual(2);
8 8
     expect(z).toEqual({ a: 3, b: 4 });
9 9
   });
10 10
 
11
-  it('handles async await', async () => {
11
+  it('async await', async () => {
12 12
     const result = await new Promise((r) => r('hello'));
13 13
     expect(result).toEqual('hello');
14 14
   });
15 15
 
16
-  it('lodash equality tests', () => {
16
+  it('equality tests', () => {
17 17
     expect(_.eq('hello', 'hello')).toBe(true);
18 18
     expect(_.isEqual('hello', 'hello')).toBe(true);
19 19
 

+ 23
- 38
lib/src/Navigation.ts View File

@@ -41,116 +41,101 @@ export class Navigation {
41 41
   }
42 42
 
43 43
   /**
44
-   * Every navigation component in your app must be registered with a unique name. The component itself is a traditional React component extending React.Component.
45
-   * @param {string} componentName Unique component name
46
-   * @param {function} getComponentClassFunc generator function, typically `() => require('./myComponent')`
44
+   * Every navigation component in your app must be registered with a unique name.
45
+   * The component itself is a traditional React component extending React.Component.
47 46
    */
48 47
   public registerComponent(componentName: string, getComponentClassFunc: ComponentProvider) {
49 48
     this.componentRegistry.registerComponent(componentName, getComponentClassFunc);
50 49
   }
51 50
 
52 51
   /**
53
-   * Reset the navigation stack to a new component (the stack root is changed).
54
-   * @param {Root} root
52
+   * Reset the app to a new layout
55 53
    */
56
-  public setRoot(params) {
57
-    return this.commands.setRoot(params);
54
+  public setRoot(layout): Promise<any> {
55
+    return this.commands.setRoot(layout);
58 56
   }
59 57
 
60 58
   /**
61 59
    * Set default options to all screens. Useful for declaring a consistent style across the app.
62
-   * @param {options:Options} options
63 60
    */
64
-  public setDefaultOptions(options) {
61
+  public setDefaultOptions(options): void {
65 62
     this.commands.setDefaultOptions(options);
66 63
   }
67 64
 
68 65
   /**
69
-   * Change a components navigation options
70
-   * @param {string} componentId The component's id.
71
-   * @param {options:Options} options
66
+   * Change a component's navigation options
72 67
    */
73
-  public setOptions(componentId, options) {
68
+  public setOptions(componentId: string, options): void {
74 69
     this.commands.setOptions(componentId, options);
75 70
   }
76 71
 
77 72
   /**
78 73
    * Show a screen as a modal.
79
-   * @param {object} params
80 74
    */
81
-  public showModal(params) {
82
-    return this.commands.showModal(params);
75
+  public showModal(layout): Promise<any> {
76
+    return this.commands.showModal(layout);
83 77
   }
84 78
 
85 79
   /**
86 80
    * Dismiss a modal by componentId. The dismissed modal can be anywhere in the stack.
87
-   * @param {string} componentId The component's id.
88 81
    */
89
-  public dismissModal(componentId) {
82
+  public dismissModal(componentId: string): Promise<any> {
90 83
     return this.commands.dismissModal(componentId);
91 84
   }
92 85
 
93 86
   /**
94 87
    * Dismiss all Modals
95 88
    */
96
-  public dismissAllModals() {
89
+  public dismissAllModals(): Promise<any> {
97 90
     return this.commands.dismissAllModals();
98 91
   }
99 92
 
100 93
   /**
101
-   * Push a new screen into this screen's navigation stack.
102
-   * @param {string} componentId The component's id.
103
-   * @param {Component} component
94
+   * Push a new layout into this screen's navigation stack.
104 95
    */
105
-  public push(componentId, component) {
106
-    return this.commands.push(componentId, component);
96
+  public push(componentId: string, layout): Promise<any> {
97
+    return this.commands.push(componentId, layout);
107 98
   }
108 99
 
109 100
   /**
110 101
    * Pop a component from the stack, regardless of it's position.
111
-   * @param {string} componentId The component's id.
112
-   * @param {*} params
113 102
    */
114
-  public pop(componentId, params) {
103
+  public pop(componentId: string, params): Promise<any> {
115 104
     return this.commands.pop(componentId, params);
116 105
   }
117 106
 
118 107
   /**
119 108
    * Pop the stack to a given component
120
-   * @param {string} componentId The component's id.
121 109
    */
122
-  public popTo(componentId: string) {
110
+  public popTo(componentId: string): Promise<any> {
123 111
     return this.commands.popTo(componentId);
124 112
   }
125 113
 
126 114
   /**
127 115
    * Pop the component's stack to root.
128
-   * @param {*} componentId
129 116
    */
130
-  public popToRoot(componentId: string) {
117
+  public popToRoot(componentId: string): Promise<any> {
131 118
     return this.commands.popToRoot(componentId);
132 119
   }
133 120
 
134 121
   /**
135
-   * Show overlay on top of the window
136
-   * @param {*} params
122
+   * Show overlay on top of the entire app
137 123
    */
138
-  public showOverlay(params) {
139
-    return this.commands.showOverlay(params);
124
+  public showOverlay(layout): Promise<any> {
125
+    return this.commands.showOverlay(layout);
140 126
   }
141 127
 
142 128
   /**
143 129
    * dismiss overlay by componentId
144
-   * @param {string} componentId
145 130
    */
146
-  public dismissOverlay(componentId: string) {
131
+  public dismissOverlay(componentId: string): Promise<any> {
147 132
     return this.commands.dismissOverlay(componentId);
148 133
   }
149 134
 
150 135
   /**
151 136
    * Obtain the events registry instance
152 137
    */
153
-  public events() {
138
+  public events(): PublicEventsRegistry {
154 139
     return this.publicEventsRegistry;
155 140
   }
156 141
 }

+ 1
- 4
lib/src/components/Lifecycle.ts View File

@@ -1,8 +1,5 @@
1 1
 export class Lifecycle {
2
-  private store;
3
-
4
-  constructor(store) {
5
-    this.store = store;
2
+  constructor(private readonly store) {
6 3
     this.componentDidAppear = this.componentDidAppear.bind(this);
7 4
     this.componentDidDisappear = this.componentDidDisappear.bind(this);
8 5
     this.onNavigationButtonPressed = this.onNavigationButtonPressed.bind(this);

+ 4
- 4
lib/src/events/PrivateEventsListener.ts View File

@@ -1,12 +1,12 @@
1 1
 import { Lifecycle } from '../components/Lifecycle';
2 2
 
3 3
 export class PrivateEventsListener {
4
-  private nativeEventsReceiver;
5 4
   private lifecycle;
6 5
 
7
-  constructor(nativeEventsReceiver, store) {
8
-    this.nativeEventsReceiver = nativeEventsReceiver;
9
-    this.lifecycle = new Lifecycle(store);
6
+  constructor(
7
+    private readonly nativeEventsReceiver,
8
+    private readonly store) {
9
+    this.lifecycle = new Lifecycle(this.store);
10 10
   }
11 11
 
12 12
   public listenAndHandlePrivateEvents() {

+ 19
- 13
package.json View File

@@ -27,23 +27,25 @@
27 27
   "scripts": {
28 28
     "build": "rm -rf ./lib/dist && tsc",
29 29
     "xcode": "open playground/ios/playground.xcodeproj",
30
-    "install-android": "node ./scripts/install-android.js",
30
+    "install-android": "node ./scripts/install-android",
31 31
     "uninstall-android": "cd playground/android && ./gradlew uninstallAll",
32
-    "clean": "node ./scripts/clean.js",
32
+    "clean": "node ./scripts/clean",
33 33
     "prestart": "npm run build",
34
-    "start": "node ./scripts/start.js",
34
+    "start": "node ./scripts/start",
35 35
     "pretest-js": "npm run build",
36
-    "test-js": "node ./scripts/test-js.js",
37
-    "test-unit-android": "node ./scripts/test.unit.android.js",
38
-    "test-unit-ios": "node ./scripts/test.unit.ios.js",
36
+    "test-js": "node ./scripts/test-js",
37
+    "test-unit-android": "node ./scripts/test-unit-android",
38
+    "test-unit-ios": "node ./scripts/test-unit-ios",
39 39
     "pretest-e2e-android": "npm run build",
40
-    "test-e2e-android": "node ./scripts/test.e2e.android.js",
41
-    "test-e2e-android-detox": "node ./scripts/test.e2e.android.detox.js",
40
+    "test-e2e-android": "node ./scripts/test-e2e-android",
41
+    "test-e2e-android-detox": "node ./scripts/test-e2e-android-detox",
42 42
     "pretest-e2e-ios": "npm run build",
43
-    "test-e2e-ios": "node ./scripts/test.e2e.ios.js",
44
-    "test-all": "node ./scripts/test.all.js",
43
+    "test-e2e-ios": "node ./scripts/test-e2e-ios",
44
+    "test-all": "node ./scripts/test-all",
45 45
     "prerelease": "npm run build",
46
-    "release": "node ./scripts/release.js"
46
+    "release": "node ./scripts/release",
47
+    "local-docs": "node ./scripts/local-docs",
48
+    "gen-docs": "./tsn.sh ./scripts/gen-docs"
47 49
   },
48 50
   "peerDependencies": {
49 51
     "react": "*",
@@ -58,7 +60,8 @@
58 60
     "@types/lodash": "4.x.x",
59 61
     "@types/prop-types": "15.x.x",
60 62
     "@types/react-test-renderer": "16.x.x",
61
-    "@types/jest": "22.x.x"
63
+    "@types/jest": "22.x.x",
64
+    "@types/node": "9.x.x"
62 65
   },
63 66
   "devDependencies": {
64 67
     "detox": "7.x.x",
@@ -73,7 +76,10 @@
73 76
     "semver": "5.x.x",
74 77
     "shell-utils": "1.x.x",
75 78
     "tslint": "5.x.x",
76
-    "typescript": "2.x.x"
79
+    "typescript": "2.x.x",
80
+    "ts-node": "5.x.x",
81
+    "typedoc": "0.x.x",
82
+    "handlebars": "4.x.x"
77 83
   },
78 84
   "babel": {
79 85
     "env": {

+ 2
- 1
playground/README.md View File

@@ -1,3 +1,4 @@
1 1
 # Navigation Playground
2 2
 
3
-An local playground project using `react-native-navigation`.
3
+A local example project using `react-native-navigation`.
4
+The target app for all e2e tests.

scripts/env/env.android.sh → scripts/env/env-android.sh View File


scripts/env/env.ios.sh → scripts/env/env-ios.sh View File


+ 116
- 0
scripts/gen-docs.ts View File

@@ -0,0 +1,116 @@
1
+import * as _ from 'lodash';
2
+import * as Typedoc from 'typedoc';
3
+import * as Handlebars from 'handlebars';
4
+import * as fs from 'fs';
5
+
6
+const ROOT_DIR = `${__dirname}/..`;
7
+const SRC_DIR = `${ROOT_DIR}/lib/src`;
8
+const DOCS_DIR = `${ROOT_DIR}/docs`;
9
+const TEMPLATES_DIR = `${DOCS_DIR}/templates`;
10
+const API_DIR = `${DOCS_DIR}/api`;
11
+
12
+class Main {
13
+  public generateApiDocsMarkdown() {
14
+    const moduleName = 'Navigation';
15
+    const reflections = new ReflectionsReader().read(moduleName);
16
+    const classRef = new Parser().parseClass(reflections);
17
+    new MarkdownCreator().create(classRef);
18
+  }
19
+}
20
+
21
+class MarkdownCreator {
22
+  private handlebarsFn: HandlebarsTemplateDelegate<any>;
23
+  constructor() {
24
+    this.handlebarsFn = this.setupHandlebars();
25
+  }
26
+
27
+  public create(context: ClassReflection) {
28
+
29
+    const result = this.handlebarsFn(context);
30
+
31
+    // console.log(result);
32
+    API_DIR.toString();
33
+  }
34
+
35
+  private setupHandlebars(): HandlebarsTemplateDelegate<any> {
36
+    const mainTemplate = readFile(`${TEMPLATES_DIR}/main.hbs`);
37
+    const classTemplate = readFile(`${TEMPLATES_DIR}/class.hbs`);
38
+    const methodTemplate = readFile(`${TEMPLATES_DIR}/method.hbs`);
39
+    Handlebars.registerPartial('class', classTemplate);
40
+    Handlebars.registerPartial('method', methodTemplate);
41
+    return Handlebars.compile(mainTemplate, { strict: true });
42
+  }
43
+}
44
+
45
+interface ClassReflection {
46
+  name: string;
47
+  methods: MethodReflection[];
48
+}
49
+
50
+interface MethodReflection {
51
+  name: string;
52
+  argumentValues: string[];
53
+  returnValue: string;
54
+  comment: string;
55
+  source: string;
56
+}
57
+
58
+class Parser {
59
+  public parseClass(reflections): ClassReflection {
60
+    const theModuleRaw = reflections.children[0];
61
+    const theClassRaw = theModuleRaw.children[0];
62
+
63
+    const methods = this.parseMethods(theClassRaw);
64
+    const result = {
65
+      name: theClassRaw.name,
66
+      methods
67
+    };
68
+    return result;
69
+  }
70
+
71
+  private parseMethods(theClassRaw): MethodReflection[] {
72
+    const methodsRaw = _.filter(theClassRaw.children, (child) => child.kind === Typedoc.ReflectionKind.Method);
73
+    methodsRaw.toString();
74
+    const result = [{
75
+      name: 'theName',
76
+      argumentValues: ['asd', 'zxc'],
77
+      returnValue: 'returnVal',
78
+      comment: 'bla bla bla',
79
+      source: 'fromHere'
80
+    }];
81
+
82
+    return result;
83
+  }
84
+}
85
+
86
+class ReflectionsReader {
87
+  private typedocApp: Typedoc.Application;
88
+  constructor() {
89
+    const tsconfig = JSON.parse(readFile(`${ROOT_DIR}/tsconfig.json`));
90
+    this.typedocApp = new Typedoc.Application({
91
+      excludeExternals: true,
92
+      excludePrivate: true,
93
+      excludeProtected: true,
94
+      includeDeclarations: true,
95
+      module: 'commonjs',
96
+      readme: 'none',
97
+      target: 'ES6',
98
+      ...tsconfig.compilerOptions
99
+    });
100
+  }
101
+  read(moduleName) {
102
+    return this.typedocApp.serializer.projectToObject(
103
+      this.typedocApp.convert(
104
+        this.typedocApp.expandInputFiles(
105
+          [`${SRC_DIR}/${moduleName}.ts`]
106
+        )
107
+      )
108
+    );
109
+  }
110
+}
111
+
112
+function readFile(f) {
113
+  return fs.readFileSync(f).toString();
114
+}
115
+
116
+new Main().generateApiDocsMarkdown();

+ 0
- 83
scripts/generate-js-doc.js View File

@@ -1,83 +0,0 @@
1
-throw new Error('temporarily disabled, until newAPI is complete');
2
-/*
3
-const jsdoc2md = require('jsdoc-to-markdown');
4
-const fs = require('fs');
5
-const path = require('path');
6
-
7
-const BASE_DIR = './lib/src/params/';
8
-const OPTIONS_DIR = BASE_DIR + 'options/';
9
-const CONTAINERS_DIR = BASE_DIR + 'components/';
10
-const OUTPUT_DIR = './docs/docs/';
11
-const PARAMS_PARTIALS = ['./docs/templates/header.hbs', './docs/templates/sig-name.hbs'];
12
-const PARTIALS = [
13
-  './docs/templates/scope.hbs',
14
-  './docs/templates/docs.hbs',
15
-  './docs/templates/param-table-name.hbs',
16
-  '/docs/templates/linked-type-list.hbs',
17
-  './docs/templates/link.hbs',
18
-  './docs/templates/params-table.hbs'
19
-];
20
-
21
-const generateMarkdownForFile = ({ file, outputDir, partial, separator }) => {
22
-  const templateData = jsdoc2md.getTemplateDataSync({ files: file });
23
-  const classNames = getClassesInFile(templateData);
24
-  classNames.forEach((className) => createDocFileForClass({ className, templateData, outputDir, partial, separator }));
25
-};
26
-
27
-function getClassesInFile(templateData) {
28
-  const classNames = templateData.reduce((classNames, identifier) => {
29
-    if (identifier.kind === 'class') {
30
-      classNames.push(identifier.name);
31
-    }
32
-    return classNames;
33
-  }, []);
34
-  return classNames;
35
-}
36
-
37
-function createDocFileForClass({ className, templateData, outputDir, partial = [], separator = true }) {
38
-  const template = `{{#class name="${className}"}}{{>docs}}{{/class}}`;
39
-  const options = {
40
-    data: templateData,
41
-    template,
42
-    separators: separator,
43
-    'heading-depth': 1,
44
-    helper: ['./docs/linkify.js', './docs/stringify.js'],
45
-    partial: [...PARTIALS, ...partial]
46
-  };
47
-  console.log(`rendering ${className}`);
48
-  const output = jsdoc2md.renderSync(options);
49
-  fs.writeFileSync(path.resolve(outputDir, `${className}.md`), output);
50
-}
51
-
52
-function inputFiles() {
53
-  return [
54
-    { file: './lib/src/Navigation.js', outputDir: OUTPUT_DIR },
55
-    ...fs.readdirSync(OPTIONS_DIR).map((file) => {
56
-      return {
57
-        file: OPTIONS_DIR + file,
58
-        outputDir: OUTPUT_DIR + 'options/',
59
-        partial: PARAMS_PARTIALS,
60
-        separator: false
61
-      };
62
-    }),
63
-    ...fs.readdirSync(CONTAINERS_DIR)
64
-      .map((file) => {
65
-        return {
66
-          file: CONTAINERS_DIR + file,
67
-          outputDir: OUTPUT_DIR,
68
-          partial: PARAMS_PARTIALS,
69
-          separator: false
70
-        };
71
-      }),
72
-    ...fs.readdirSync(BASE_DIR)
73
-      .filter((file) => fs.statSync(BASE_DIR + file).isFile())
74
-      .map((file) => {
75
-        return {
76
-          file: BASE_DIR + file,
77
-          outputDir: OUTPUT_DIR
78
-        };
79
-      })
80
-  ];
81
-}
82
-
83
-inputFiles().forEach((inputFile) => generateMarkdownForFile(inputFile)); */

+ 32
- 0
scripts/local-docs.js View File

@@ -0,0 +1,32 @@
1
+const http = require('http');
2
+const fs = require('fs');
3
+
4
+const PORT = 3000;
5
+const ROOT = `${__dirname}/../docs`;
6
+
7
+run();
8
+
9
+function run() {
10
+
11
+  http.createServer((req, res) => {
12
+    console.log(req.url);
13
+    const path = `${ROOT}${req.url === '/' ? '/index.html' : req.url}`;
14
+    fs.readFile(path, (err, data) => {
15
+      if (err) {
16
+        console.error(err);
17
+        res.writeHead(404, err.message);
18
+      } else {
19
+        res.writeHead(200, {
20
+          'Content-Type': 'text/html',
21
+          'Cache-Control': 'private, no-cache, no-store, must-revalidate',
22
+          'Expires': '-1',
23
+          'Pragma': 'no-cache'
24
+        });
25
+        res.write(data);
26
+      }
27
+      res.end();
28
+    });
29
+  }).listen(PORT, () => {
30
+    console.log(`Listening for ${ROOT} on localhost:${PORT}`);
31
+  });
32
+}

scripts/test.all.js → scripts/test-all.js View File


scripts/test.e2e.android.detox.js → scripts/test-e2e-android-detox.js View File


scripts/test.e2e.android.js → scripts/test-e2e-android.js View File


scripts/test.e2e.ios.js → scripts/test-e2e-ios.js View File


scripts/test.unit.android.js → scripts/test-unit-android.js View File


scripts/test.unit.ios.js → scripts/test-unit-ios.js View File


+ 9
- 1
tsconfig.json View File

@@ -6,7 +6,15 @@
6 6
     "target": "esnext",
7 7
     "module": "commonjs",
8 8
     "jsx": "react-native",
9
-    "declaration": true
9
+    "declaration": true,
10
+    "types": [
11
+      "jest",
12
+      "lodash",
13
+      "prop-types",
14
+      "react",
15
+      "react-native",
16
+      "react-test-renderer"
17
+    ]
10 18
   },
11 19
   "include": [
12 20
     "./lib/src/**/*"

+ 3
- 0
tsn.sh View File

@@ -0,0 +1,3 @@
1
+#!/bin/bash -e
2
+
3
+ts-node --typeCheck --compilerOptions '{"types":["node"]}' $1