Browse Source

comment out old code

Daniel Zlotin 8 years ago
parent
commit
badeb80f6f

+ 71
- 37
src/deprecated/platformSpecificDeprecated.android.js View File

22
   //const drawer = setupDrawer(params.drawer);
22
   //const drawer = setupDrawer(params.drawer);
23
 
23
 
24
   screen.screenId = screen.screen;
24
   screen.screenId = screen.screen;
25
+
26
+  /*
27
+   * adapt to new API
28
+   */
29
+  params.screen = adaptNavigationStyleToScreenStyle(screen);
30
+  params.screen = adaptNavigationParams(screen);
31
+
25
   newPlatformSpecific.startApp(params);
32
   newPlatformSpecific.startApp(params);
26
 }
33
 }
27
 
34
 
28
-function startTabBasedApp(params) {
29
-  if (!params.tabs) {
30
-    console.error('startTabBasedApp(params): params.tabs is required');
31
-    return;
35
+function adaptNavigationStyleToScreenStyle(screen) {
36
+  const navigatorStyle = screen.navigatorStyle;
37
+  if (!navigatorStyle) {
38
+    return screen;
32
   }
39
   }
33
 
40
 
34
-  params.tabs.forEach(function(tab, idx) {
35
-    addNavigatorParams(tab, null, idx);
36
-    addNavigatorButtons(tab);
37
-    addNavigationStyleParams(tab);
38
-    addTabIcon(tab);
39
-    tab.passProps = params.passProps;
40
-  });
41
+  screen.styleParams = {
42
+    statusBarColor: navigatorStyle.statusBarColor,
43
+    topBarColor: navigatorStyle.toolBarColor,
44
+    navigationBarColor: navigatorStyle.navigationBarColor,
45
+    titleBarHidden: navigatorStyle.navBarHidden,
46
+    backButtonHidden: navigatorStyle.backButtonHidden,
47
+    topTabsHidden: navigatorStyle.topTabsHidden,
48
+    bottomTabsHidden: navigatorStyle.tabBarHidden,
49
+    bottomTabsHiddenOnScroll: navigatorStyle.bottomTabsHiddenOnScroll
50
+  };
51
+
52
+  return _.omit(screen, ['navigatorStyle']);
53
+}
54
+
55
+function adaptNavigationParams(screen) {
56
+  screen.navigationParams = {
57
+    screenInstanceID: screen.screenInstanceID,
58
+    navigatorID: screen.navigatorID,
59
+    navigatorEventID: screen.navigatorEventID
60
+  };
61
+  return _.omit(screen, ['screenInstanceID', 'navigatorID', 'navigatorEventID']);
62
+}
41
 
63
 
42
-  const drawer = setupDrawer(params.drawer);
64
+function startTabBasedApp(params) {
65
+  //if (!params.tabs) {
66
+  //  console.error('startTabBasedApp(params): params.tabs is required');
67
+  //  return;
68
+  //}
69
+  //
70
+  //params.tabs.forEach(function(tab, idx) {
71
+  //  addNavigatorParams(tab, null, idx);
72
+  //  addNavigatorButtons(tab);
73
+  //  addNavigationStyleParams(tab);
74
+  //  addTabIcon(tab);
75
+  //  tab.passProps = params.passProps;
76
+  //});
77
+  //
78
+  //const drawer = setupDrawer(params.drawer);
43
   //RctActivity.startTabBasedApp(params.tabs, params.tabsStyle, drawer);
79
   //RctActivity.startTabBasedApp(params.tabs, params.tabsStyle, drawer);
44
 }
80
 }
45
 
81
 
57
 }
93
 }
58
 
94
 
59
 function navigatorPush(navigator, params) {
95
 function navigatorPush(navigator, params) {
60
-  addNavigatorParams(params, navigator);
61
-  addNavigatorButtons(params);
62
-  addNavigationStyleParams(params);
96
+  //addNavigatorParams(params, navigator);
97
+  //addNavigatorButtons(params);
98
+  //addNavigationStyleParams(params);
63
   //RctActivity.navigatorPush(params);
99
   //RctActivity.navigatorPush(params);
64
 }
100
 }
65
 
101
 
66
 function navigatorSetButtons(navigator, navigatorEventID, params) {
102
 function navigatorSetButtons(navigator, navigatorEventID, params) {
67
-  if (params.rightButtons) {
68
-    params.rightButtons.forEach(function(button) {
69
-      if (button.icon) {
70
-        const icon = resolveAssetSource(button.icon);
71
-        if (icon) {
72
-          button.icon = icon.uri;
73
-        }
74
-      }
75
-    });
76
-  }
103
+  //if (params.rightButtons) {
104
+  //  params.rightButtons.forEach(function(button) {
105
+  //    if (button.icon) {
106
+  //      const icon = resolveAssetSource(button.icon);
107
+  //      if (icon) {
108
+  //        button.icon = icon.uri;
109
+  //      }
110
+  //    }
111
+  //  });
112
+  //}
77
   //RctActivity.setNavigatorButtons(params);
113
   //RctActivity.setNavigatorButtons(params);
78
 }
114
 }
79
 
115
 
80
 function navigatorPop(navigator, params) {
116
 function navigatorPop(navigator, params) {
81
-  addNavigatorParams(params, navigator);
117
+  //addNavigatorParams(params, navigator);
82
   //RctActivity.navigatorPop(params);
118
   //RctActivity.navigatorPop(params);
83
 }
119
 }
84
 
120
 
90
 }
126
 }
91
 
127
 
92
 function navigatorResetTo(navigator, params) {
128
 function navigatorResetTo(navigator, params) {
93
-  addNavigatorParams(params, navigator);
94
-  addNavigatorButtons(params);
95
-  addNavigationStyleParams(params);
129
+  //addNavigatorParams(params, navigator);
130
+  //addNavigatorButtons(params);
131
+  //addNavigationStyleParams(params);
96
   //RctActivity.navigatorResetTo(params);
132
   //RctActivity.navigatorResetTo(params);
97
 }
133
 }
98
 
134
 
137
 }
173
 }
138
 
174
 
139
 function showModal(params) {
175
 function showModal(params) {
140
-  addNavigatorParams(params);
141
-  addNavigatorButtons(params);
142
-  addNavigationStyleParams(params);
176
+  //addNavigatorParams(params);
177
+  //addNavigatorButtons(params);
178
+  //addNavigationStyleParams(params);
143
   //RctActivity.showModal(params);
179
   //RctActivity.showModal(params);
144
 }
180
 }
145
 
181
 
162
   Object.assign(screen, Screen.navigatorButtons);
198
   Object.assign(screen, Screen.navigatorButtons);
163
 
199
 
164
   // Get image uri from image id
200
   // Get image uri from image id
165
-  const rightButtons = screen.rightButtons ? screen.rightButtons : screen.navigatorButtons ?
166
-                                                                   screen.navigatorButtons.rightButtons : null;
201
+  const rightButtons = screen.navigatorButtons ? screen.navigatorButtons.rightButtons : null;
167
 
202
 
168
   if (rightButtons) {
203
   if (rightButtons) {
169
     rightButtons.forEach(function(button) {
204
     rightButtons.forEach(function(button) {
198
   if (drawer.disableOpenGesture === undefined) {
233
   if (drawer.disableOpenGesture === undefined) {
199
     drawer.disableOpenGesture = false;
234
     drawer.disableOpenGesture = false;
200
   }
235
   }
201
-  ;
202
 
236
 
203
   return drawer;
237
   return drawer;
204
 }
238
 }
205
 
239
 
206
 function showFAB(params) {
240
 function showFAB(params) {
207
-  params.icon = resolveAssetSource(params.icon).uri;
241
+  //params.icon = resolveAssetSource(params.icon).uri;
208
   //RctActivity.showFAB(params);
242
   //RctActivity.showFAB(params);
209
 }
243
 }
210
 
244
 
226
   navigatorToggleDrawer,
260
   navigatorToggleDrawer,
227
   navigatorToggleTabs,
261
   navigatorToggleTabs,
228
   navigatorToggleNavBar
262
   navigatorToggleNavBar
229
-}
263
+};

+ 1
- 35
src/platformSpecific.android.js View File

7
 const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
7
 const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
8
 
8
 
9
 function startApp(params) {
9
 function startApp(params) {
10
-  let screen = params.screen;
10
+  const screen = params.screen;
11
   if (!screen.screenId) {
11
   if (!screen.screenId) {
12
     console.error('startApp(params): screenId property must be supplied');
12
     console.error('startApp(params): screenId property must be supplied');
13
     return;
13
     return;
14
   }
14
   }
15
 
15
 
16
-  params.screen = convertNavigationStyleToScreenStyle(screen);
17
-  params.screen = createNavigationParams(screen);
18
-
19
   NativeModules.NavigationReactModule.startApp(params);
16
   NativeModules.NavigationReactModule.startApp(params);
20
 }
17
 }
21
 
18
 
22
-function convertNavigationStyleToScreenStyle(screen) {
23
-  const navigatorStyle = screen.navigatorStyle;
24
-  if (!navigatorStyle) {
25
-    return screen;
26
-  }
27
-
28
-  screen.styleParams = {
29
-    statusBarColor: navigatorStyle.statusBarColor,
30
-    topBarColor: navigatorStyle.toolBarColor,
31
-    navigationBarColor: navigatorStyle.navigationBarColor,
32
-    titleBarHidden: navigatorStyle.navBarHidden,
33
-    backButtonHidden: navigatorStyle.backButtonHidden,
34
-    topTabsHidden: navigatorStyle.topTabsHidden,
35
-    bottomTabsHidden: navigatorStyle.tabBarHidden,
36
-    bottomTabsHiddenOnScroll: navigatorStyle.bottomTabsHiddenOnScroll
37
-  };
38
-
39
-  screen = _.omit(screen, ['navigatorStyle']);
40
-  return screen;
41
-}
42
-
43
-function createNavigationParams(screen) {
44
-  screen.navigationParams = {
45
-    screenInstanceID: screen.screenInstanceID,
46
-    navigatorID: screen.navigatorID,
47
-    navigatorEventID: screen.navigatorEventID
48
-  };
49
-  screen = _.omit(screen, ['screenInstanceID', 'navigatorID', 'navigatorEventID']);
50
-  return screen;
51
-}
52
-
53
 module.exports = {
19
 module.exports = {
54
   startApp
20
   startApp
55
 };
21
 };