Browse Source

deprecated

Daniel Zlotin 8 years ago
parent
commit
0059b12217

+ 1
- 1
src/Navigation.js View File

1
 import React from 'react';
1
 import React from 'react';
2
 import {AppRegistry} from 'react-native';
2
 import {AppRegistry} from 'react-native';
3
-import platformSpecific from './platformSpecificDeprecated';
3
+import platformSpecific from './deprecated/platformSpecificDeprecated';
4
 import Screen from './Screen';
4
 import Screen from './Screen';
5
 
5
 
6
 const registeredScreens = {};
6
 const registeredScreens = {};

+ 1
- 1
src/Screen.js View File

4
   DeviceEventEmitter,
4
   DeviceEventEmitter,
5
   Platform
5
   Platform
6
 } from 'react-native';
6
 } from 'react-native';
7
-import platformSpecific from './platformSpecificDeprecated';
7
+import platformSpecific from './deprecated/platformSpecificDeprecated';
8
 import Navigation from './Navigation';
8
 import Navigation from './Navigation';
9
 
9
 
10
 const _allNavigatorEventHandlers = {};
10
 const _allNavigatorEventHandlers = {};

src/platformSpecificDeprecated.android.js → src/deprecated/platformSpecificDeprecated.android.js View File

3
 import _ from 'lodash';
3
 import _ from 'lodash';
4
 import utils from './utils';
4
 import utils from './utils';
5
 
5
 
6
-import Navigation from './Navigation';
6
+import Navigation from './../Navigation';
7
 
7
 
8
 const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
8
 const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
9
 
9
 
10
-import * as newPlatformSpecific from './platformSpecific';
10
+import * as newPlatformSpecific from './../platformSpecific';
11
 
11
 
12
 function startSingleScreenApp(params) {
12
 function startSingleScreenApp(params) {
13
   const screen = params.screen;
13
   const screen = params.screen;

src/platformSpecificDeprecated.ios.js → src/deprecated/platformSpecificDeprecated.ios.js View File

1
 import utils from './utils';
1
 import utils from './utils';
2
-import Navigation from './Navigation';
3
-import Controllers, { Modal, Notification } from 'react-native-controllers';
2
+import Navigation from './../Navigation';
3
+import Controllers, {Modal, Notification} from 'react-native-controllers';
4
 const React = Controllers.hijackReact();
4
 const React = Controllers.hijackReact();
5
 const {
5
 const {
6
   ControllerRegistry,
6
   ControllerRegistry,
23
         const navigatorID = controllerID + '_drawer';
23
         const navigatorID = controllerID + '_drawer';
24
         return (
24
         return (
25
           <DrawerControllerIOS id={navigatorID}
25
           <DrawerControllerIOS id={navigatorID}
26
-            componentLeft={params.drawer.left ? params.drawer.left.screen : undefined}
27
-            passPropsLeft={{navigatorID: navigatorID}}
28
-            componentRight={params.drawer.right ? params.drawer.right.screen : undefined}
29
-            passPropsRight={{navigatorID: navigatorID}}
30
-            disableOpenGesture={params.drawer.disableOpenGesture}
31
-            type={params.drawer.type ? params.drawer.type : undefined}
32
-            animationType={params.drawer.animationType ? params.drawer.animationType : undefined}
26
+                               componentLeft={params.drawer.left ? params.drawer.left.screen : undefined}
27
+                               passPropsLeft={{navigatorID: navigatorID}}
28
+                               componentRight={params.drawer.right ? params.drawer.right.screen : undefined}
29
+                               passPropsRight={{navigatorID: navigatorID}}
30
+                               disableOpenGesture={params.drawer.disableOpenGesture}
31
+                               type={params.drawer.type ? params.drawer.type : undefined}
32
+                               animationType={params.drawer.animationType ? params.drawer.animationType : undefined}
33
           >
33
           >
34
             {this.renderBody()}
34
             {this.renderBody()}
35
           </DrawerControllerIOS>
35
           </DrawerControllerIOS>
42
           id={controllerID + '_tabs'}
42
           id={controllerID + '_tabs'}
43
           style={params.tabsStyle}>
43
           style={params.tabsStyle}>
44
           {
44
           {
45
-          params.tabs.map(function(tab, index) {
46
-            const navigatorID = controllerID + '_nav' + index;
47
-            const screenInstanceID = utils.getRandomId();
48
-            if (!tab.screen) {
49
-              console.error('startTabBasedApp(params): every tab must include a screen property, take a look at tab#' + (index+1));
50
-              return;
51
-            }
52
-            const {
53
-              navigatorStyle,
54
-              navigatorButtons,
55
-              navigatorEventID
56
-            } = _mergeScreenSpecificSettings(tab.screen, screenInstanceID, tab);
57
-            return (
58
-              <TabBarControllerIOS.Item {...tab} title={tab.label}>
59
-                <NavigationControllerIOS
60
-                  id={navigatorID}
61
-                  title={tab.title}
62
-                  titleImage={tab.titleImage}
63
-                  component={tab.screen}
64
-                  passProps={{
45
+            params.tabs.map(function(tab, index) {
46
+              const navigatorID = controllerID + '_nav' + index;
47
+              const screenInstanceID = utils.getRandomId();
48
+              if (!tab.screen) {
49
+                console.error('startTabBasedApp(params): every tab must include a screen property, take a look at tab#' + (index + 1));
50
+                return;
51
+              }
52
+              const {
53
+                navigatorStyle,
54
+                navigatorButtons,
55
+                navigatorEventID
56
+              } = _mergeScreenSpecificSettings(tab.screen, screenInstanceID, tab);
57
+              return (
58
+                <TabBarControllerIOS.Item {...tab} title={tab.label}>
59
+                  <NavigationControllerIOS
60
+                    id={navigatorID}
61
+                    title={tab.title}
62
+                    titleImage={tab.titleImage}
63
+                    component={tab.screen}
64
+                    passProps={{
65
                     navigatorID: navigatorID,
65
                     navigatorID: navigatorID,
66
                     screenInstanceID: screenInstanceID,
66
                     screenInstanceID: screenInstanceID,
67
                     navigatorEventID: navigatorEventID
67
                     navigatorEventID: navigatorEventID
68
                   }}
68
                   }}
69
-                  style={navigatorStyle}
70
-                  leftButtons={navigatorButtons.leftButtons}
71
-                  rightButtons={navigatorButtons.rightButtons}
72
-                />
73
-              </TabBarControllerIOS.Item>
74
-            );
75
-          })
76
-        }
69
+                    style={navigatorStyle}
70
+                    leftButtons={navigatorButtons.leftButtons}
71
+                    rightButtons={navigatorButtons.rightButtons}
72
+                  />
73
+                </TabBarControllerIOS.Item>
74
+              );
75
+            })
76
+          }
77
         </TabBarControllerIOS>
77
         </TabBarControllerIOS>
78
       );
78
       );
79
     }
79
     }
96
         const navigatorID = controllerID + '_drawer';
96
         const navigatorID = controllerID + '_drawer';
97
         return (
97
         return (
98
           <DrawerControllerIOS id={navigatorID}
98
           <DrawerControllerIOS id={navigatorID}
99
-            componentLeft={params.drawer.left ? params.drawer.left.screen : undefined}
100
-            passPropsLeft={{navigatorID: navigatorID}}
101
-            componentRight={params.drawer.right ? params.drawer.right.screen : undefined}
102
-            passPropsRight={{navigatorID: navigatorID}}
103
-            disableOpenGesture={params.drawer.disableOpenGesture}>
99
+                               componentLeft={params.drawer.left ? params.drawer.left.screen : undefined}
100
+                               passPropsLeft={{navigatorID: navigatorID}}
101
+                               componentRight={params.drawer.right ? params.drawer.right.screen : undefined}
102
+                               passPropsRight={{navigatorID: navigatorID}}
103
+                               disableOpenGesture={params.drawer.disableOpenGesture}>
104
             {this.renderBody()}
104
             {this.renderBody()}
105
           </DrawerControllerIOS>
105
           </DrawerControllerIOS>
106
         );
106
         );
158
     Object.assign(navigatorButtons, params.navigatorButtons);
158
     Object.assign(navigatorButtons, params.navigatorButtons);
159
   }
159
   }
160
   if (navigatorButtons.leftButtons) {
160
   if (navigatorButtons.leftButtons) {
161
-    for (let i = 0 ; i < navigatorButtons.leftButtons.length ; i++) {
161
+    for (let i = 0; i < navigatorButtons.leftButtons.length; i++) {
162
       navigatorButtons.leftButtons[i].onPress = navigatorEventID;
162
       navigatorButtons.leftButtons[i].onPress = navigatorEventID;
163
     }
163
     }
164
   }
164
   }
165
   if (navigatorButtons.rightButtons) {
165
   if (navigatorButtons.rightButtons) {
166
-    for (let i = 0 ; i < navigatorButtons.rightButtons.length ; i++) {
166
+    for (let i = 0; i < navigatorButtons.rightButtons.length; i++) {
167
       navigatorButtons.rightButtons[i].onPress = navigatorEventID;
167
       navigatorButtons.rightButtons[i].onPress = navigatorEventID;
168
     }
168
     }
169
   }
169
   }
170
-  return { navigatorStyle, navigatorButtons, navigatorEventID };
170
+  return {navigatorStyle, navigatorButtons, navigatorEventID};
171
 }
171
 }
172
 
172
 
173
 function navigatorPush(navigator, params) {
173
 function navigatorPush(navigator, params) {
318
 function navigatorSetButtons(navigator, navigatorEventID, params) {
318
 function navigatorSetButtons(navigator, navigatorEventID, params) {
319
   if (params.leftButtons) {
319
   if (params.leftButtons) {
320
     const buttons = params.leftButtons.slice(); // clone
320
     const buttons = params.leftButtons.slice(); // clone
321
-    for (let i = 0 ; i < buttons.length ; i++) {
321
+    for (let i = 0; i < buttons.length; i++) {
322
       buttons[i].onPress = navigatorEventID;
322
       buttons[i].onPress = navigatorEventID;
323
     }
323
     }
324
     Controllers.NavigationControllerIOS(navigator.navigatorID).setLeftButtons(buttons, params.animated);
324
     Controllers.NavigationControllerIOS(navigator.navigatorID).setLeftButtons(buttons, params.animated);
325
   }
325
   }
326
   if (params.rightButtons) {
326
   if (params.rightButtons) {
327
     const buttons = params.rightButtons.slice(); // clone
327
     const buttons = params.rightButtons.slice(); // clone
328
-    for (let i = 0 ; i < buttons.length ; i++) {
328
+    for (let i = 0; i < buttons.length; i++) {
329
       buttons[i].onPress = navigatorEventID;
329
       buttons[i].onPress = navigatorEventID;
330
     }
330
     }
331
     Controllers.NavigationControllerIOS(navigator.navigatorID).setRightButtons(buttons, params.animated);
331
     Controllers.NavigationControllerIOS(navigator.navigatorID).setRightButtons(buttons, params.animated);

src/utils.js → src/deprecated/utils.js View File