|
@@ -22,17 +22,17 @@ App-wide support for 100% native navigation with an easy cross-platform interfac
|
22
|
22
|
|
23
|
23
|
* In your project folder run `npm install react-native-navigation --save`
|
24
|
24
|
> Note: We recommend using npm ver 3+. If you insist on using npm ver 2 please notice that the location for react-native-controllers in node_modules will be under the react-native-navigation folder and you'll need to change the paths in Xcode below accordingly.
|
25
|
|
-
|
|
25
|
+
|
26
|
26
|
* Add the native files of the dependency [react-native-controllers](https://github.com/wix/react-native-controllers) to your Xcode project:
|
27
|
27
|
|
28
|
28
|
* In Xcode, in Project Navigator (left pane), right-click on the `Libraries` > `Add files to [project name]`. Add `./node_modules/react-native-controllers/ios/ReactNativeControllers.xcodeproj` ([screenshots](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#step-1))
|
29
|
|
-
|
|
29
|
+
|
30
|
30
|
* 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 `libReactNativeControllers.a` ([screenshots](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#step-2))
|
31
|
31
|
|
32
|
32
|
* 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-controllers/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))
|
33
|
33
|
|
34
|
34
|
* In Xcode, under your project files, modify `AppDelegate.m` according to this [example](https://github.com/wix/react-native-navigation/blob/master/example/ios/example/AppDelegate.m)
|
35
|
|
-
|
|
35
|
+
|
36
|
36
|
## Installation - Android
|
37
|
37
|
|
38
|
38
|
Coming soon, not yet supported
|
|
@@ -77,7 +77,7 @@ Navigation.startTabBasedApp({
|
77
|
77
|
|
78
|
78
|
#### Step 2 - Register all of your screen components
|
79
|
79
|
|
80
|
|
-Every screen that you want to be able to place in a tab, push to the navigation stack or present modally needs to be registered. We recommend doing this in a central place, like [`screens/index.js`](example/src/screens/index.js).
|
|
80
|
+Every screen that you want to be able to place in a tab, push to the navigation stack or present modally needs to be registered. We recommend doing this in a central place, like [`screens/index.js`](example/src/screens/index.js).
|
81
|
81
|
|
82
|
82
|
> Note: Since your screens will potentially be bundled with other packages, your registered name must be **unique**! Follow a namespacing convention like `packageName.ScreenName`.
|
83
|
83
|
|
|
@@ -105,8 +105,8 @@ import { Navigation } from 'react-native-navigation';
|
105
|
105
|
```
|
106
|
106
|
|
107
|
107
|
* **registerComponent(screenID, generator, store = undefined, Provider = undefined)**
|
108
|
|
-
|
109
|
|
-Every screen component in your app must be registered with a unique name. The component itself is a traditional React component extending `React.Component`.
|
|
108
|
+
|
|
109
|
+Every screen component in your app must be registered with a unique name. The component itself is a traditional React component extending `React.Component`.
|
110
|
110
|
|
111
|
111
|
```js
|
112
|
112
|
// not using redux (just ignore the last 2 arguments)
|
|
@@ -117,7 +117,7 @@ Navigation.registerComponent('example.FirstTabScreen', () => FirstTabScreen, sto
|
117
|
117
|
```
|
118
|
118
|
|
119
|
119
|
* **startTabBasedApp(params)**
|
120
|
|
-
|
|
120
|
+
|
121
|
121
|
Change your app root into an app based on several tabs (usually 2-5), a very common pattern in iOS (like Facebook app or the iOS Contacts app). Every tab has its own navigation stack with a native nav bar.
|
122
|
122
|
|
123
|
123
|
```js
|
|
@@ -156,7 +156,7 @@ Navigation.startTabBasedApp({
|
156
|
156
|
```
|
157
|
157
|
|
158
|
158
|
* **startSingleScreenApp(params)**
|
159
|
|
-
|
|
159
|
+
|
160
|
160
|
Change your app root into an app based on a single screen (like the iOS Calendar or Settings app). The screen will receive its own navigation stack with a native nav bar
|
161
|
161
|
|
162
|
162
|
```js
|
|
@@ -180,7 +180,7 @@ Navigation.startSingleScreenApp({
|
180
|
180
|
* **showModal(params = {})**
|
181
|
181
|
|
182
|
182
|
Show a screen as a modal.
|
183
|
|
-
|
|
183
|
+
|
184
|
184
|
```js
|
185
|
185
|
Navigation.showModal({
|
186
|
186
|
screen: "example.ModalScreen", // unique ID registered with Navigation.registerScreen
|
|
@@ -199,10 +199,33 @@ Dismiss the current modal.
|
199
|
199
|
Navigation.dismissModal({
|
200
|
200
|
animationType: 'slide-down' // 'none' / 'slide-down' , dismiss animation for the modal (optional, default 'slide-down')
|
201
|
201
|
});
|
|
202
|
+```
|
|
203
|
+
|
|
204
|
+* **showLightBox(params = {})**
|
|
205
|
+
|
|
206
|
+Show a screen as a lightbox.
|
|
207
|
+
|
|
208
|
+```js
|
|
209
|
+Navigation.showLightBox({
|
|
210
|
+ screen: "example.LightBoxScreen", // unique ID registered with Navigation.registerScreen
|
|
211
|
+ passProps: {}, // simple serializable object that will pass as props to the lightbox (optional)
|
|
212
|
+ style: {
|
|
213
|
+ backgroundBlur: "dark", // 'dark' / 'light' / 'xlight' / 'none' - the type of blur on the background
|
|
214
|
+ backgroundColor: "#ff000080" // tint color for the background, you can specify alpha here (optional)
|
|
215
|
+ }
|
|
216
|
+});
|
|
217
|
+```
|
|
218
|
+
|
|
219
|
+* **dismissLightBox(params = {})**
|
|
220
|
+
|
|
221
|
+Dismiss the current lightbox.
|
|
222
|
+
|
|
223
|
+```js
|
|
224
|
+Navigation.dismissLightBox();
|
202
|
225
|
```
|
203
|
226
|
|
204
|
227
|
* **registerScreen(screenID, generator)**
|
205
|
|
-
|
|
228
|
+
|
206
|
229
|
This is an internal function you probably don't want to use directly. If your screen components extend `Screen` directly (`import { Screen } from 'react-native-navigation'`), you can register them directly with `registerScreen` instead of with `registerComponent`. The main benefit of using `registerComponent` is that it wraps your regular screen component with a `Screen` automatically.
|
207
|
230
|
|
208
|
231
|
```js
|
|
@@ -224,6 +247,7 @@ this.props.navigator.push({
|
224
|
247
|
passProps: {}, // simple serializable object that will pass as props to the pushed screen (optional)
|
225
|
248
|
animated: true, // does the push have transition animation or does it happen immediately (optional)
|
226
|
249
|
backButtonTitle: undefined, // override the back button title (optional)
|
|
250
|
+ backButtonHidden: false, // hide the back button altogether (optional)
|
227
|
251
|
navigatorStyle: {} // override the navigator style for the pushed screen (optional)
|
228
|
252
|
});
|
229
|
253
|
```
|
|
@@ -265,7 +289,7 @@ this.props.navigator.resetTo({
|
265
|
289
|
* **showModal(params = {})**
|
266
|
290
|
|
267
|
291
|
Show a screen as a modal.
|
268
|
|
-
|
|
292
|
+
|
269
|
293
|
```js
|
270
|
294
|
this.props.navigator.showModal({
|
271
|
295
|
screen: "example.ModalScreen", // unique ID registered with Navigation.registerScreen
|
|
@@ -284,6 +308,29 @@ Dismiss the current modal.
|
284
|
308
|
this.props.navigator.dismissModal({
|
285
|
309
|
animationType: 'slide-down' // 'none' / 'slide-down' , dismiss animation for the modal (optional, default 'slide-down')
|
286
|
310
|
});
|
|
311
|
+```
|
|
312
|
+
|
|
313
|
+* **showLightBox(params = {})**
|
|
314
|
+
|
|
315
|
+Show a screen as a lightbox.
|
|
316
|
+
|
|
317
|
+```js
|
|
318
|
+this.props.navigator.showLightBox({
|
|
319
|
+ screen: "example.LightBoxScreen", // unique ID registered with Navigation.registerScreen
|
|
320
|
+ passProps: {}, // simple serializable object that will pass as props to the lightbox (optional)
|
|
321
|
+ style: {
|
|
322
|
+ backgroundBlur: "dark", // 'dark' / 'light' / 'xlight' / 'none' - the type of blur on the background
|
|
323
|
+ backgroundColor: "#ff000080" // tint color for the background, you can specify alpha here (optional)
|
|
324
|
+ }
|
|
325
|
+});
|
|
326
|
+```
|
|
327
|
+
|
|
328
|
+* **dismissLightBox(params = {})**
|
|
329
|
+
|
|
330
|
+Dismiss the current lightbox.
|
|
331
|
+
|
|
332
|
+```js
|
|
333
|
+this.props.navigator.dismissLightBox();
|
287
|
334
|
```
|
288
|
335
|
|
289
|
336
|
* **handleDeepLink(params = {})**
|
|
@@ -429,7 +476,8 @@ class FirstTabScreen extends Component {
|
429
|
476
|
{
|
430
|
477
|
title: 'Edit', // for a textual button, provide the button title (label)
|
431
|
478
|
id: 'edit', // id for this button, given in onNavigatorEvent(event) to help understand which button was clicked
|
432
|
|
- testID: 'e2e_rules' // optional, used to locate this view in end-to-end tests
|
|
479
|
+ testID: 'e2e_rules', // optional, used to locate this view in end-to-end tests
|
|
480
|
+ disabled: true // optional, used to disable the button (appears faded and doesn't interact)
|
433
|
481
|
},
|
434
|
482
|
{
|
435
|
483
|
icon: require('../../img/navicon_add.png'), // for icon button, provide the local image asset name
|
|
@@ -467,7 +515,8 @@ class FirstTabScreen extends Component {
|
467
|
515
|
title: 'Edit', // if you want a textual button
|
468
|
516
|
icon: require('../../img/navicon_edit.png'), // if you want an image button
|
469
|
517
|
id: 'compose', // id of the button which will pass to your press event handler
|
470
|
|
- testID: 'e2e_is_awesome' // if you have e2e tests, use this to find your button
|
|
518
|
+ testID: 'e2e_is_awesome', // if you have e2e tests, use this to find your button
|
|
519
|
+ disabled: true // optional, used to disable the button (appears faded and doesn't interact)
|
471
|
520
|
}],
|
472
|
521
|
leftButtons: [] // buttons for the left side of the nav bar (optional)
|
473
|
522
|
}
|