|
@@ -41,7 +41,8 @@ function startTabBasedApp(params) {
|
41
|
41
|
passProps={{
|
42
|
42
|
navigatorID: navigatorID,
|
43
|
43
|
screenInstanceID: screenInstanceID,
|
44
|
|
- navigatorEventID: navigatorEventID
|
|
44
|
+ navigatorEventID: navigatorEventID,
|
|
45
|
+ listenForEvents: !!(navigatorButtons.leftButtons || navigatorButtons.rightButtons)
|
45
|
46
|
}}
|
46
|
47
|
style={navigatorStyle}
|
47
|
48
|
leftButtons={navigatorButtons.leftButtons}
|
|
@@ -87,7 +88,8 @@ function startSingleScreenApp(params) {
|
87
|
88
|
passProps={{
|
88
|
89
|
navigatorID: navigatorID,
|
89
|
90
|
screenInstanceID: screenInstanceID,
|
90
|
|
- navigatorEventID: navigatorEventID
|
|
91
|
+ navigatorEventID: navigatorEventID,
|
|
92
|
+ listenForEvents: !!(navigatorButtons.leftButtons || navigatorButtons.rightButtons)
|
91
|
93
|
}}
|
92
|
94
|
style={navigatorStyle}
|
93
|
95
|
leftButtons={navigatorButtons.leftButtons}
|
|
@@ -110,18 +112,16 @@ function _mergeScreenSpecificSettings(screenID, screenInstanceID, params) {
|
110
|
112
|
if (params.navigatorStyle) {
|
111
|
113
|
Object.assign(navigatorStyle, params.navigatorStyle);
|
112
|
114
|
}
|
113
|
|
- let navigatorEventID;
|
|
115
|
+
|
|
116
|
+ const navigatorEventID = screenInstanceID + '_events';
|
114
|
117
|
const navigatorButtons = Object.assign({}, screenClass.navigatorButtons);
|
115
|
118
|
if (navigatorButtons.leftButtons) {
|
116
|
119
|
for (let i = 0 ; i < navigatorButtons.leftButtons.length ; i++) {
|
117
|
|
- navigatorEventID = screenInstanceID + '_events';
|
118
|
120
|
navigatorButtons.leftButtons[i].onPress = navigatorEventID;
|
119
|
121
|
}
|
120
|
122
|
}
|
121
|
123
|
if (navigatorButtons.rightButtons) {
|
122
|
|
- navigatorEventID = screenInstanceID + '_events';
|
123
|
124
|
for (let i = 0 ; i < navigatorButtons.rightButtons.length ; i++) {
|
124
|
|
- navigatorEventID = screenInstanceID + '_events';
|
125
|
125
|
navigatorButtons.rightButtons[i].onPress = navigatorEventID;
|
126
|
126
|
}
|
127
|
127
|
}
|
|
@@ -143,6 +143,7 @@ function navigatorPush(navigator, params) {
|
143
|
143
|
passProps.navigatorID = navigator.navigatorID;
|
144
|
144
|
passProps.screenInstanceID = screenInstanceID;
|
145
|
145
|
passProps.navigatorEventID = navigatorEventID;
|
|
146
|
+ passProps.listenForEvents = !!(navigatorButtons.leftButtons || navigatorButtons.rightButtons);
|
146
|
147
|
Controllers.NavigationControllerIOS(navigator.navigatorID).push({
|
147
|
148
|
title: params.title,
|
148
|
149
|
component: params.screen,
|
|
@@ -161,6 +162,23 @@ function navigatorPop(navigator, params) {
|
161
|
162
|
});
|
162
|
163
|
}
|
163
|
164
|
|
|
165
|
+function navigatorSetButtons(navigator, navigatorEventID, params) {
|
|
166
|
+ if (params.leftButtons) {
|
|
167
|
+ const buttons = params.leftButtons.slice(); // clone
|
|
168
|
+ for (let i = 0 ; i < buttons.length ; i++) {
|
|
169
|
+ buttons[i].onPress = navigatorEventID;
|
|
170
|
+ }
|
|
171
|
+ Controllers.NavigationControllerIOS(navigator.navigatorID).setLeftButtons(buttons, params.animated);
|
|
172
|
+ }
|
|
173
|
+ if (params.rightButtons) {
|
|
174
|
+ const buttons = params.rightButtons.slice(); // clone
|
|
175
|
+ for (let i = 0 ; i < buttons.length ; i++) {
|
|
176
|
+ buttons[i].onPress = navigatorEventID;
|
|
177
|
+ }
|
|
178
|
+ Controllers.NavigationControllerIOS(navigator.navigatorID).setRightButtons(buttons, params.animated);
|
|
179
|
+ }
|
|
180
|
+}
|
|
181
|
+
|
164
|
182
|
function showModal(params) {
|
165
|
183
|
if (!params.screen) {
|
166
|
184
|
console.error('showModal(params): params.screen is required');
|
|
@@ -180,6 +198,7 @@ function showModal(params) {
|
180
|
198
|
passProps.navigatorID = navigatorID;
|
181
|
199
|
passProps.screenInstanceID = screenInstanceID;
|
182
|
200
|
passProps.navigatorEventID = navigatorEventID;
|
|
201
|
+ passProps.listenForEvents = !!(navigatorButtons.leftButtons || navigatorButtons.rightButtons);
|
183
|
202
|
return (
|
184
|
203
|
<NavigationControllerIOS
|
185
|
204
|
id={navigatorID}
|
|
@@ -207,5 +226,6 @@ export default platformSpecific = {
|
207
|
226
|
navigatorPush,
|
208
|
227
|
navigatorPop,
|
209
|
228
|
showModal,
|
210
|
|
- dismissModal
|
|
229
|
+ dismissModal,
|
|
230
|
+ navigatorSetButtons
|
211
|
231
|
}
|