|
@@ -1,12 +1,12 @@
|
1
|
1
|
# Top Level API
|
2
|
2
|
|
3
|
|
-### `Navigation`
|
|
3
|
+## Navigation
|
4
|
4
|
|
5
|
5
|
```js
|
6
|
6
|
import { Navigation } from 'react-native-navigation';
|
7
|
7
|
```
|
8
|
8
|
|
9
|
|
-#### `registerComponent(screenID, generator, store = undefined, Provider = undefined)`
|
|
9
|
+## registerComponent(screenID, generator, store = undefined, Provider = undefined)
|
10
|
10
|
|
11
|
11
|
Every screen component in your app must be registered with a unique name. The component itself is a traditional React component extending `React.Component`.
|
12
|
12
|
|
|
@@ -18,7 +18,7 @@ Navigation.registerComponent('example.FirstTabScreen', () => FirstTabScreen);
|
18
|
18
|
Navigation.registerComponent('example.FirstTabScreen', () => FirstTabScreen, store, Provider);
|
19
|
19
|
```
|
20
|
20
|
|
21
|
|
-#### `startTabBasedApp(params)`
|
|
21
|
+## startTabBasedApp(params)
|
22
|
22
|
|
23
|
23
|
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.
|
24
|
24
|
|
|
@@ -58,10 +58,12 @@ Navigation.startTabBasedApp({
|
58
|
58
|
},
|
59
|
59
|
drawer: { // optional, add this if you want a side menu drawer in your app
|
60
|
60
|
left: { // optional, define if you want a drawer from the left
|
61
|
|
- screen: 'example.FirstSideMenu' // unique ID registered with Navigation.registerScreen
|
|
61
|
+ screen: 'example.FirstSideMenu', // unique ID registered with Navigation.registerScreen
|
|
62
|
+ passProps: {} // simple serializable object that will pass as props to all top screens (optional)
|
62
|
63
|
},
|
63
|
64
|
right: { // optional, define if you want a drawer from the right
|
64
|
|
- screen: 'example.SecondSideMenu' // unique ID registered with Navigation.registerScreen
|
|
65
|
+ screen: 'example.SecondSideMenu', // unique ID registered with Navigation.registerScreen
|
|
66
|
+ passProps: {} // simple serializable object that will pass as props to all top screens (optional)
|
65
|
67
|
},
|
66
|
68
|
disableOpenGesture: false // optional, can the drawer be opened with a swipe instead of button
|
67
|
69
|
},
|
|
@@ -70,10 +72,7 @@ Navigation.startTabBasedApp({
|
70
|
72
|
});
|
71
|
73
|
```
|
72
|
74
|
|
73
|
|
-##### Listening to tab selected events
|
74
|
|
-In order to listen to `bottomTabSelected` event, set an `onNavigatorEventListener` on screens that are pushed to BottomTab. The event is dispatched to the top most screen pushed to the selected tab's stack.
|
75
|
|
-
|
76
|
|
-#### `startSingleScreenApp(params)`
|
|
75
|
+## startSingleScreenApp(params)
|
77
|
76
|
|
78
|
77
|
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
|
79
|
78
|
|
|
@@ -87,10 +86,12 @@ Navigation.startSingleScreenApp({
|
87
|
86
|
},
|
88
|
87
|
drawer: { // optional, add this if you want a side menu drawer in your app
|
89
|
88
|
left: { // optional, define if you want a drawer from the left
|
90
|
|
- screen: 'example.FirstSideMenu' // unique ID registered with Navigation.registerScreen
|
|
89
|
+ screen: 'example.FirstSideMenu', // unique ID registered with Navigation.registerScreen
|
|
90
|
+ passProps: {}, // simple serializable object that will pass as props to all top screens (optional)
|
91
|
91
|
},
|
92
|
92
|
right: { // optional, define if you want a drawer from the right
|
93
|
|
- screen: 'example.SecondSideMenu' // unique ID registered with Navigation.registerScreen
|
|
93
|
+ screen: 'example.SecondSideMenu', // unique ID registered with Navigation.registerScreen
|
|
94
|
+ passProps: {} // simple serializable object that will pass as props to all top screens (optional)
|
94
|
95
|
},
|
95
|
96
|
disableOpenGesture: false // optional, can the drawer be opened with a swipe instead of button
|
96
|
97
|
},
|
|
@@ -99,7 +100,7 @@ Navigation.startSingleScreenApp({
|
99
|
100
|
});
|
100
|
101
|
```
|
101
|
102
|
|
102
|
|
-#### `showModal(params = {})`
|
|
103
|
+## showModal(params = {})
|
103
|
104
|
|
104
|
105
|
Show a screen as a modal.
|
105
|
106
|
|
|
@@ -114,7 +115,7 @@ Navigation.showModal({
|
114
|
115
|
});
|
115
|
116
|
```
|
116
|
117
|
|
117
|
|
-#### `dismissModal(params = {})`
|
|
118
|
+## dismissModal(params = {})
|
118
|
119
|
|
119
|
120
|
Dismiss the current modal.
|
120
|
121
|
|
|
@@ -124,7 +125,7 @@ Navigation.dismissModal({
|
124
|
125
|
});
|
125
|
126
|
```
|
126
|
127
|
|
127
|
|
-#### `dismissAllModals(params = {})`
|
|
128
|
+## dismissAllModals(params = {})
|
128
|
129
|
|
129
|
130
|
Dismiss all the current modals at the same time.
|
130
|
131
|
|
|
@@ -134,7 +135,7 @@ Navigation.dismissAllModals({
|
134
|
135
|
});
|
135
|
136
|
```
|
136
|
137
|
|
137
|
|
-#### `showLightBox(params = {})`
|
|
138
|
+## showLightBox(params = {})
|
138
|
139
|
|
139
|
140
|
Show a screen as a lightbox.
|
140
|
141
|
|
|
@@ -149,7 +150,7 @@ Navigation.showLightBox({
|
149
|
150
|
});
|
150
|
151
|
```
|
151
|
152
|
|
152
|
|
-#### `dismissLightBox(params = {})`
|
|
153
|
+## dismissLightBox(params = {})
|
153
|
154
|
|
154
|
155
|
Dismiss the current lightbox.
|
155
|
156
|
|
|
@@ -157,7 +158,7 @@ Dismiss the current lightbox.
|
157
|
158
|
Navigation.dismissLightBox();
|
158
|
159
|
```
|
159
|
160
|
|
160
|
|
-#### `registerScreen(screenID, generator)`
|
|
161
|
+## registerScreen(screenID, generator)
|
161
|
162
|
|
162
|
163
|
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.
|
163
|
164
|
|