ソースを参照

comment out old code

Daniel Zlotin 8 年 前
コミット
badeb80f6f
共有2 個のファイルを変更した72 個の追加72 個の削除を含む
  1. 71
    37
      src/deprecated/platformSpecificDeprecated.android.js
  2. 1
    35
      src/platformSpecific.android.js

+ 71
- 37
src/deprecated/platformSpecificDeprecated.android.js ファイルの表示

@@ -22,24 +22,60 @@ function startSingleScreenApp(params) {
22 22
   //const drawer = setupDrawer(params.drawer);
23 23
 
24 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 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 79
   //RctActivity.startTabBasedApp(params.tabs, params.tabsStyle, drawer);
44 80
 }
45 81
 
@@ -57,28 +93,28 @@ function addTabIcon(tab) {
57 93
 }
58 94
 
59 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 99
   //RctActivity.navigatorPush(params);
64 100
 }
65 101
 
66 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 113
   //RctActivity.setNavigatorButtons(params);
78 114
 }
79 115
 
80 116
 function navigatorPop(navigator, params) {
81
-  addNavigatorParams(params, navigator);
117
+  //addNavigatorParams(params, navigator);
82 118
   //RctActivity.navigatorPop(params);
83 119
 }
84 120
 
@@ -90,9 +126,9 @@ function navigatorPopToRoot(navigator, params) {
90 126
 }
91 127
 
92 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 132
   //RctActivity.navigatorResetTo(params);
97 133
 }
98 134
 
@@ -137,9 +173,9 @@ function navigatorToggleTabs(navigator, params) {
137 173
 }
138 174
 
139 175
 function showModal(params) {
140
-  addNavigatorParams(params);
141
-  addNavigatorButtons(params);
142
-  addNavigationStyleParams(params);
176
+  //addNavigatorParams(params);
177
+  //addNavigatorButtons(params);
178
+  //addNavigationStyleParams(params);
143 179
   //RctActivity.showModal(params);
144 180
 }
145 181
 
@@ -162,8 +198,7 @@ function addNavigatorButtons(screen) {
162 198
   Object.assign(screen, Screen.navigatorButtons);
163 199
 
164 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 203
   if (rightButtons) {
169 204
     rightButtons.forEach(function(button) {
@@ -198,13 +233,12 @@ function setupDrawer(drawerParams) {
198 233
   if (drawer.disableOpenGesture === undefined) {
199 234
     drawer.disableOpenGesture = false;
200 235
   }
201
-  ;
202 236
 
203 237
   return drawer;
204 238
 }
205 239
 
206 240
 function showFAB(params) {
207
-  params.icon = resolveAssetSource(params.icon).uri;
241
+  //params.icon = resolveAssetSource(params.icon).uri;
208 242
   //RctActivity.showFAB(params);
209 243
 }
210 244
 
@@ -226,4 +260,4 @@ export default {
226 260
   navigatorToggleDrawer,
227 261
   navigatorToggleTabs,
228 262
   navigatorToggleNavBar
229
-}
263
+};

+ 1
- 35
src/platformSpecific.android.js ファイルの表示

@@ -7,49 +7,15 @@ import Navigation from './Navigation';
7 7
 const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
8 8
 
9 9
 function startApp(params) {
10
-  let screen = params.screen;
10
+  const screen = params.screen;
11 11
   if (!screen.screenId) {
12 12
     console.error('startApp(params): screenId property must be supplied');
13 13
     return;
14 14
   }
15 15
 
16
-  params.screen = convertNavigationStyleToScreenStyle(screen);
17
-  params.screen = createNavigationParams(screen);
18
-
19 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 19
 module.exports = {
54 20
   startApp
55 21
 };