Преглед изворни кода

remove src. will no longer merge from master

Daniel Zlotin пре 8 година
родитељ
комит
29aac91111

+ 1
- 1
.travis.yml Прегледај датотеку

@@ -43,7 +43,7 @@ script:
43 43
   - yarn run test:js
44 44
   - ./scripts/installAndroidSDK.sh
45 45
   - yarn run test:android
46
-  - yarn run release
46
+#  - yarn run release
47 47
 
48 48
 after_script:
49 49
   - echo "BUILD FINISHED"

+ 0
- 150
src/Navigation.js Прегледај датотеку

@@ -1,150 +0,0 @@
1
-/*eslint-disable*/
2
-import React from 'react';
3
-import {AppRegistry} from 'react-native';
4
-import platformSpecific from './deprecated/platformSpecificDeprecated';
5
-import Screen from './Screen';
6
-
7
-import PropRegistry from './PropRegistry';
8
-
9
-const registeredScreens = {};
10
-
11
-function registerScreen(screenID, generator) {
12
-  registeredScreens[screenID] = generator;
13
-  AppRegistry.registerComponent(screenID, generator);
14
-}
15
-
16
-function registerComponent(screenID, generator, store = undefined, Provider = undefined) {
17
-  if (store && Provider) {
18
-    return _registerComponentRedux(screenID, generator, store, Provider);
19
-  } else {
20
-    return _registerComponentNoRedux(screenID, generator);
21
-  }
22
-}
23
-
24
-function _registerComponentNoRedux(screenID, generator) {
25
-  const generatorWrapper = function() {
26
-    const InternalComponent = generator();
27
-    return class extends Screen {
28
-      static navigatorStyle = InternalComponent.navigatorStyle || {};
29
-      static navigatorButtons = InternalComponent.navigatorButtons || {};
30
-
31
-      constructor(props) {
32
-        super(props);
33
-        this.state = {
34
-          internalProps: {...props, ...PropRegistry.load(props.screenInstanceID)}
35
-        }
36
-      }
37
-
38
-      componentWillReceiveProps(nextProps) {
39
-        this.setState({
40
-          internalProps: {...PropRegistry.load(this.props.screenInstanceID), ...nextProps}
41
-        })
42
-      }
43
-
44
-      render() {
45
-        return (
46
-          <InternalComponent testID={screenID} navigator={this.navigator} {...this.state.internalProps} />
47
-        );
48
-      }
49
-    };
50
-  };
51
-  registerScreen(screenID, generatorWrapper);
52
-  return generatorWrapper;
53
-}
54
-
55
-function _registerComponentRedux(screenID, generator, store, Provider) {
56
-  const generatorWrapper = function() {
57
-    const InternalComponent = generator();
58
-    return class extends Screen {
59
-      static navigatorStyle = InternalComponent.navigatorStyle || {};
60
-      static navigatorButtons = InternalComponent.navigatorButtons || {};
61
-
62
-      constructor(props) {
63
-        super(props);
64
-        this.state = {
65
-          internalProps: {...props, ...PropRegistry.load(props.screenInstanceID)}
66
-        }
67
-      }
68
-
69
-      componentWillReceiveProps(nextProps) {
70
-        this.setState({
71
-          internalProps: {...PropRegistry.load(this.props.screenInstanceID), ...nextProps}
72
-        })
73
-      }
74
-
75
-      render() {
76
-        return (
77
-          <Provider store={store}>
78
-            <InternalComponent testID={screenID} navigator={this.navigator} {...this.state.internalProps} />
79
-          </Provider>
80
-        );
81
-      }
82
-    };
83
-  };
84
-  registerScreen(screenID, generatorWrapper);
85
-  return generatorWrapper;
86
-}
87
-
88
-function getRegisteredScreen(screenID) {
89
-  const generator = registeredScreens[screenID];
90
-  if (!generator) {
91
-    console.error(`Navigation.getRegisteredScreen: ${screenID} used but not yet registered`);
92
-    return undefined;
93
-  }
94
-  return generator();
95
-}
96
-
97
-function showModal(params = {}) {
98
-  return platformSpecific.showModal(params);
99
-}
100
-
101
-function dismissModal(params = {}) {
102
-  return platformSpecific.dismissModal(params);
103
-}
104
-
105
-function dismissAllModals(params = {}) {
106
-  return platformSpecific.dismissAllModals(params);
107
-}
108
-
109
-function showLightBox(params = {}) {
110
-  return platformSpecific.showLightBox(params);
111
-}
112
-
113
-function dismissLightBox(params = {}) {
114
-  return platformSpecific.dismissLightBox(params);
115
-}
116
-
117
-function showInAppNotification(params = {}) {
118
-  return platformSpecific.showInAppNotification(params);
119
-}
120
-
121
-function dismissInAppNotification(params = {}) {
122
-  return platformSpecific.dismissInAppNotification(params);
123
-}
124
-
125
-function startTabBasedApp(params) {
126
-  return platformSpecific.startTabBasedApp(params);
127
-}
128
-
129
-function startSingleScreenApp(params) {
130
-  return platformSpecific.startSingleScreenApp(params);
131
-}
132
-
133
-function startApp(layout) {
134
-    return platformSpecific.startApp(layout);
135
-}
136
-
137
-export default {
138
-  getRegisteredScreen,
139
-  registerComponent,
140
-  showModal: showModal,
141
-  dismissModal: dismissModal,
142
-  dismissAllModals: dismissAllModals,
143
-  showLightBox: showLightBox,
144
-  dismissLightBox: dismissLightBox,
145
-  showInAppNotification: showInAppNotification,
146
-  dismissInAppNotification: dismissInAppNotification,
147
-  startTabBasedApp: startTabBasedApp,
148
-  startSingleScreenApp: startSingleScreenApp,
149
-  startApp: startApp
150
-};

+ 0
- 15
src/PropRegistry.js Прегледај датотеку

@@ -1,15 +0,0 @@
1
-class PropRegistry {
2
-  constructor() {
3
-    this.registry = {};
4
-  }
5
-
6
-  save(screenInstanceId = '', passProps = {}) {
7
-    this.registry[screenInstanceId] = passProps;
8
-  }
9
-
10
-  load(screenInstanceId = '') {
11
-    return this.registry[screenInstanceId] || {};
12
-  }
13
-}
14
-
15
-module.exports = new PropRegistry();

+ 0
- 172
src/Screen.js Прегледај датотеку

@@ -1,172 +0,0 @@
1
-/*eslint-disable*/
2
-import React, {Component} from 'react';
3
-import {
4
-  NativeAppEventEmitter,
5
-  DeviceEventEmitter,
6
-  Platform
7
-} from 'react-native';
8
-import platformSpecific from './deprecated/platformSpecificDeprecated';
9
-import Navigation from './Navigation';
10
-
11
-const _allNavigatorEventHandlers = {};
12
-
13
-const NavigationSpecific = {
14
-  push: platformSpecific.navigatorPush,
15
-  pop: platformSpecific.navigatorPop,
16
-  popToRoot: platformSpecific.navigatorPopToRoot,
17
-  resetTo: platformSpecific.navigatorResetTo
18
-};
19
-
20
-class Navigator {
21
-  constructor(navigatorID, navigatorEventID, screenInstanceID) {
22
-    this.navigatorID = navigatorID;
23
-    this.screenInstanceID = screenInstanceID;
24
-    this.navigatorEventID = navigatorEventID;
25
-    this.navigatorEventHandler = null;
26
-    this.navigatorEventSubscription = null;
27
-  }
28
-
29
-  push(params = {}) {
30
-    return NavigationSpecific.push(this, params);
31
-  }
32
-
33
-  pop(params = {}) {
34
-    return NavigationSpecific.pop(this, params);
35
-  }
36
-
37
-  popToRoot(params = {}) {
38
-    return NavigationSpecific.popToRoot(this, params);
39
-  }
40
-
41
-  resetTo(params = {}) {
42
-    return NavigationSpecific.resetTo(this, params);
43
-  }
44
-
45
-  showModal(params = {}) {
46
-    return Navigation.showModal(params);
47
-  }
48
-
49
-  dismissModal(params = {}) {
50
-    return Navigation.dismissModal(params);
51
-  }
52
-
53
-  dismissAllModals(params = {}) {
54
-    return Navigation.dismissAllModals(params);
55
-  }
56
-
57
-  showLightBox(params = {}) {
58
-    return Navigation.showLightBox(params);
59
-  }
60
-
61
-  dismissLightBox(params = {}) {
62
-    return Navigation.dismissLightBox(params);
63
-  }
64
-
65
-  showInAppNotification(params = {}) {
66
-    return Navigation.showInAppNotification(params);
67
-  }
68
-
69
-  dismissInAppNotification(params = {}) {
70
-    return Navigation.dismissInAppNotification(params);
71
-  }
72
-
73
-  setButtons(params = {}) {
74
-    return platformSpecific.navigatorSetButtons(this, this.navigatorEventID, params);
75
-  }
76
-
77
-  setTitle(params = {}) {
78
-    return platformSpecific.navigatorSetTitle(this, params);
79
-  }
80
-
81
-  setSubTitle(params = {}) {
82
-    return platformSpecific.navigatorSetSubtitle(this, params);
83
-  }
84
-
85
-  setTitleImage(params = {}) {
86
-    return platformSpecific.navigatorSetTitleImage(this, params);
87
-  }
88
-
89
-  toggleDrawer(params = {}) {
90
-    return platformSpecific.navigatorToggleDrawer(this, params);
91
-  }
92
-
93
-  toggleTabs(params = {}) {
94
-    return platformSpecific.navigatorToggleTabs(this, params);
95
-  }
96
-
97
-  toggleNavBar(params = {}) {
98
-    return platformSpecific.navigatorToggleNavBar(this, params);
99
-  }
100
-
101
-  setTabBadge(params = {}) {
102
-    return platformSpecific.navigatorSetTabBadge(this, params);
103
-  }
104
-
105
-  switchToTab(params = {}) {
106
-    return platformSpecific.navigatorSwitchToTab(this, params);
107
-  }
108
-
109
-  showSnackbar(params = {}) {
110
-    return platformSpecific.showSnackbar(this, params);
111
-  }
112
-
113
-  showContextualMenu(params, onButtonPressed) {
114
-    return platformSpecific.showContextualMenu(this, params, onButtonPressed);
115
-  }
116
-
117
-  dismissContextualMenu() {
118
-    return platformSpecific.dismissContextualMenu();
119
-  }
120
-
121
-  setOnNavigatorEvent(callback) {
122
-    this.navigatorEventHandler = callback;
123
-    if (!this.navigatorEventSubscription) {
124
-      let Emitter = Platform.OS === 'android' ? DeviceEventEmitter : NativeAppEventEmitter;
125
-      this.navigatorEventSubscription = Emitter.addListener(this.navigatorEventID, (event) => this.onNavigatorEvent(event));
126
-      _allNavigatorEventHandlers[this.navigatorEventID] = (event) => this.onNavigatorEvent(event);
127
-    }
128
-  }
129
-
130
-  handleDeepLink(params = {}) {
131
-    if (!params.link) return;
132
-    const event = {
133
-      type: 'DeepLink',
134
-      link: params.link
135
-    };
136
-    for (let i in _allNavigatorEventHandlers) {
137
-      _allNavigatorEventHandlers[i](event);
138
-    }
139
-  }
140
-
141
-  onNavigatorEvent(event) {
142
-    if (this.navigatorEventHandler) {
143
-      this.navigatorEventHandler(event);
144
-    }
145
-  }
146
-
147
-  cleanup() {
148
-    if (this.navigatorEventSubscription) {
149
-      this.navigatorEventSubscription.remove();
150
-      delete _allNavigatorEventHandlers[this.navigatorEventID];
151
-    }
152
-  }
153
-}
154
-
155
-export default class Screen extends Component {
156
-  static navigatorStyle = {};
157
-  static navigatorButtons = {};
158
-
159
-  constructor(props) {
160
-    super(props);
161
-    if (props.navigatorID) {
162
-      this.navigator = new Navigator(props.navigatorID, props.navigatorEventID, props.screenInstanceID);
163
-    }
164
-  }
165
-
166
-  componentWillUnmount() {
167
-    if (this.navigator) {
168
-      this.navigator.cleanup();
169
-      this.navigator = undefined;
170
-    }
171
-  }
172
-}

+ 0
- 10
src/deprecated/controllers/Constants.js Прегледај датотеку

@@ -1,10 +0,0 @@
1
-
2
-export const MMDRAWER_DOOR = 'door';
3
-export const MMDRAWER_PARALLAX = 'parallax';
4
-export const MMDRAWER_SLIDE = 'slide';
5
-export const MMDRAWER_SLIDE_AND_SCALE = 'slide-and-scale';
6
-
7
-export const THE_SIDEBAR_AIRBNB = 'airbnb';
8
-export const THE_SIDEBAR_FACEBOOK = 'facebook';
9
-export const THE_SIDEBAR_LUVOCRACY = 'luvocracy';
10
-export const THE_SIDEBAR_WUNDER_LIST = 'wunder-list';

+ 0
- 310
src/deprecated/controllers/index.js Прегледај датотеку

@@ -1,310 +0,0 @@
1
-/*eslint-disable*/
2
-var OriginalReactNative = require('react-native');
3
-var RCCManager = OriginalReactNative.NativeModules.RCCManager;
4
-var NativeAppEventEmitter = OriginalReactNative.NativeAppEventEmitter;
5
-var utils = require('./utils');
6
-var Constants = require('./Constants');
7
-var resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
8
-var processColor = OriginalReactNative.processColor;
9
-
10
-var _controllerRegistry = {};
11
-
12
-function _getRandomId() {
13
-  return (Math.random()*1e20).toString(36);
14
-}
15
-
16
-function _processProperties(properties) {
17
-  for (var property in properties) {
18
-    if (properties.hasOwnProperty(property)) {
19
-      if (property === 'icon' || property.endsWith('Icon') || property.endsWith('Image')) {
20
-        properties[property] = resolveAssetSource(properties[property]);
21
-      }
22
-      if (property === 'color' || property.endsWith('Color')) {
23
-        properties[property] = processColor(properties[property]);
24
-      }
25
-      if (property === 'buttons' || property.endsWith('Buttons')) {
26
-        _processButtons(properties[property]);
27
-      }
28
-    }
29
-  }
30
-}
31
-
32
-function _setListener(callbackId, func) {
33
-  return NativeAppEventEmitter.addListener(callbackId, (...args) => func(...args));
34
-}
35
-
36
-function _processButtons(buttons) {
37
-  if (!buttons) return;
38
-  var unsubscribes = [];
39
-  for (var i = 0 ; i < buttons.length ; i++) {
40
-    buttons[i] = Object.assign({}, buttons[i]);
41
-    var button = buttons[i];
42
-    _processProperties(button);
43
-    if (typeof button.onPress === "function") {
44
-      var onPressId = _getRandomId();
45
-      var onPressFunc = button.onPress;
46
-      button.onPress = onPressId;
47
-      var unsubscribe = _setListener(onPressId, onPressFunc);
48
-      unsubscribes.push(unsubscribe);
49
-    }
50
-  }
51
-  return function () {
52
-    for (var i = 0 ; i < unsubscribes.length ; i++) {
53
-      if (unsubscribes[i]) { unsubscribes[i](); }
54
-    }
55
-  };
56
-}
57
-
58
-function _validateDrawerProps(layout) {
59
-  if (layout.type === "DrawerControllerIOS") {
60
-    let shouldSetToDefault = true;
61
-
62
-    const drawerProps = layout.props;
63
-    if (drawerProps.type === "MMDrawer") {
64
-      [ Constants.MMDRAWER_DOOR, Constants.MMDRAWER_PARALLAX, Constants.MMDRAWER_SLIDE, Constants.MMDRAWER_SLIDE_AND_SCALE].forEach(function(type) {
65
-        if (type === drawerProps.animationType){
66
-          shouldSetToDefault = false;
67
-        }
68
-      })
69
-    }
70
-    else if (drawerProps.type === "TheSideBar") {
71
-      [Constants.THE_SIDEBAR_AIRBNB, Constants.THE_SIDEBAR_FACEBOOK, Constants.THE_SIDEBAR_LUVOCRACY, Constants.THE_SIDEBAR_WUNDER_LIST].forEach(function(type) {
72
-        if (type === drawerProps.animationType){
73
-          shouldSetToDefault = false;
74
-        }
75
-      })
76
-    }
77
-
78
-    if (shouldSetToDefault) {
79
-      console.warn("Set to default type=MMDrawer animationType=slide");
80
-      drawerProps.type = "MMDrawer";
81
-      drawerProps.animationType = "slide";
82
-    }
83
-  }
84
-}
85
-
86
-
87
-var Controllers = {
88
-
89
-  createClass: function (app) {
90
-    return app;
91
-  },
92
-
93
-  hijackReact: function () {
94
-    return {
95
-      createElement: function(type, props) {
96
-        var children = Array.prototype.slice.call(arguments, 2);
97
-        var flatChildren = utils.flattenDeep(children);
98
-        props = Object.assign({}, props);
99
-        _processProperties(props);
100
-        if (props['style']) {
101
-          props['style'] = Object.assign({}, props['style']);
102
-          _processProperties(props['style']);
103
-        }
104
-        return {
105
-          'type': type.name,
106
-          'props': props,
107
-          'children': flatChildren
108
-        };
109
-      },
110
-
111
-      ControllerRegistry: Controllers.ControllerRegistry,
112
-      TabBarControllerIOS: {name: 'TabBarControllerIOS', Item: {name: 'TabBarControllerIOS.Item'}},
113
-      NavigationControllerIOS: {name: 'NavigationControllerIOS'},
114
-      ViewControllerIOS: {name: 'ViewControllerIOS'},
115
-      DrawerControllerIOS: {name: 'DrawerControllerIOS'},
116
-    };
117
-  },
118
-
119
-  ControllerRegistry: {
120
-    registerController: function (appKey, getControllerFunc) {
121
-      _controllerRegistry[appKey] = getControllerFunc();
122
-    },
123
-    setRootController: function (appKey, animationType = 'none', passProps = {}) {
124
-      var controller = _controllerRegistry[appKey];
125
-      if (controller === undefined) return;
126
-      var layout = controller.render();
127
-      _validateDrawerProps(layout);
128
-      RCCManager.setRootController(layout, animationType, passProps);
129
-    }
130
-  },
131
-
132
-  NavigationControllerIOS: function (id) {
133
-    return {
134
-      push: function (params) {
135
-        var unsubscribes = [];
136
-        if (params['style']) {
137
-          params['style'] = Object.assign({}, params['style']);
138
-          _processProperties(params['style']);
139
-        }
140
-        if (params['titleImage']) {
141
-          params['titleImage'] = resolveAssetSource(params['titleImage']);
142
-        }
143
-        if (params['leftButtons']) {
144
-          var unsubscribe = _processButtons(params['leftButtons']);
145
-          unsubscribes.push(unsubscribe);
146
-        }
147
-        if (params['rightButtons']) {
148
-          var unsubscribe = _processButtons(params['rightButtons']);
149
-          unsubscribes.push(unsubscribe);
150
-        }
151
-        RCCManager.NavigationControllerIOS(id, "push", params);
152
-        return function() {
153
-          for (var i = 0 ; i < unsubscribes.length ; i++) {
154
-            if (unsubscribes[i]) { unsubscribes[i](); }
155
-          }
156
-        };
157
-      },
158
-      pop: function (params) {
159
-        RCCManager.NavigationControllerIOS(id, "pop", params);
160
-      },
161
-      popToRoot: function (params) {
162
-        RCCManager.NavigationControllerIOS(id, "popToRoot", params);
163
-      },
164
-      setTitle: function (params) {
165
-        if (params['style']) {
166
-          params['style'] = Object.assign({}, params['style']);
167
-          _processProperties(params['style']);
168
-        }
169
-        if (params['titleImage']) {
170
-          params['titleImage'] = resolveAssetSource(params['titleImage']);
171
-        }
172
-        RCCManager.NavigationControllerIOS(id, "setTitle", params);
173
-      },
174
-      resetTo: function (params) {
175
-        var unsubscribes = [];
176
-        if (params['style']) {
177
-          params['style'] = Object.assign({}, params['style']);
178
-          _processProperties(params['style']);
179
-        }
180
-        if (params['leftButtons']) {
181
-          var unsubscribe = _processButtons(params['leftButtons']);
182
-          unsubscribes.push(unsubscribe);
183
-        }
184
-        if (params['rightButtons']) {
185
-          var unsubscribe = _processButtons(params['rightButtons']);
186
-          unsubscribes.push(unsubscribe);
187
-        }
188
-        RCCManager.NavigationControllerIOS(id, "resetTo", params);
189
-        return function() {
190
-          for (var i = 0 ; i < unsubscribes.length ; i++) {
191
-            if (unsubscribes[i]) { unsubscribes[i](); }
192
-          }
193
-        };
194
-      },
195
-      setLeftButton: function () {
196
-        console.error('setLeftButton is deprecated, see setLeftButtons');
197
-      },
198
-      setLeftButtons: function (buttons, animated = false) {
199
-        var unsubscribe = _processButtons(buttons);
200
-        RCCManager.NavigationControllerIOS(id, "setButtons", {buttons: buttons, side: "left", animated: animated});
201
-        return unsubscribe;
202
-      },
203
-      setRightButtons: function (buttons, animated = false) {
204
-        var unsubscribe = _processButtons(buttons);
205
-        RCCManager.NavigationControllerIOS(id, "setButtons", {buttons: buttons, side: "right", animated: animated});
206
-        return unsubscribe;
207
-      },
208
-      setHidden: function(params = {}) {
209
-        RCCManager.NavigationControllerIOS(id, "setHidden", params);
210
-      }
211
-    };
212
-  },
213
-
214
-  DrawerControllerIOS: function (id) {
215
-    return {
216
-      open: function (params) {
217
-        return RCCManager.DrawerControllerIOS(id, "open", params);
218
-      },
219
-      close: function (params) {
220
-        return RCCManager.DrawerControllerIOS(id, "close", params);
221
-      },
222
-      toggle: function (params) {
223
-        return RCCManager.DrawerControllerIOS(id, "toggle", params);
224
-      },
225
-      setStyle: function (params) {
226
-        return RCCManager.DrawerControllerIOS(id, "setStyle", params);
227
-      }
228
-    };
229
-  },
230
-
231
-  TabBarControllerIOS: function (id) {
232
-    return {
233
-      setHidden: function (params) {
234
-        return RCCManager.TabBarControllerIOS(id, "setTabBarHidden", params);
235
-      },
236
-      setBadge: function (params) {
237
-        return RCCManager.TabBarControllerIOS(id, "setBadge", params);
238
-      },
239
-      switchTo: function (params) {
240
-        return RCCManager.TabBarControllerIOS(id, "switchTo", params);
241
-      }
242
-    };
243
-  },
244
-
245
-  Modal: {
246
-    showLightBox: function(params) {
247
-      params['style'] = Object.assign({}, params['style']);
248
-      _processProperties(params['style']);
249
-      RCCManager.modalShowLightBox(params);
250
-    },
251
-    dismissLightBox: function() {
252
-      RCCManager.modalDismissLightBox();
253
-    },
254
-    showController: function(appKey, animationType = 'slide-up', passProps = {}) {
255
-      var controller = _controllerRegistry[appKey];
256
-      if (controller === undefined) return;
257
-      var layout = controller.render();
258
-      _validateDrawerProps(layout);
259
-      RCCManager.showController(layout, animationType, passProps);
260
-    },
261
-    dismissController: function(animationType = 'slide-down') {
262
-      RCCManager.dismissController(animationType);
263
-    },
264
-    dismissAllControllers: function(animationType = 'slide-down') {
265
-      RCCManager.dismissAllControllers(animationType);
266
-    }
267
-  },
268
-
269
-  Notification: {
270
-    show: async function(params = {}) {
271
-      await RCCManager.showNotification(params);
272
-    },
273
-    dismiss: async function(params = {}) {
274
-      await RCCManager.dismissNotification(params);
275
-    },
276
-    AnimationPresets: {
277
-      default: {
278
-        animated: true,
279
-        duration: 0.5,
280
-        damping: 0.65,
281
-        type: 'slide-down',
282
-        fade: true
283
-      },
284
-      simple: {
285
-        animated: true,
286
-        duration: 0.3,
287
-        type: 'slide-down',
288
-        fade: true
289
-      },
290
-      swing: {
291
-        animated: true,
292
-        duration: 0.65,
293
-        damping: 0.6,
294
-        type: 'swing'
295
-      },
296
-      fade: {
297
-        animated: true,
298
-        duration: 0.3,
299
-        fade: true
300
-      }
301
-    }
302
-  },
303
-
304
-  NavigationToolBarIOS: OriginalReactNative.requireNativeComponent('RCCToolBar', null),
305
-
306
-  Constants: Constants
307
-};
308
-
309
-module.exports = Controllers;
310
-

+ 0
- 82
src/deprecated/controllers/utils.js Прегледај датотеку

@@ -1,82 +0,0 @@
1
-/*eslint-disable*/
2
-var INFINITY = 1 / 0;
3
-var MAX_SAFE_INTEGER = 9007199254740991;
4
-
5
-function flattenDeep(array) {
6
-  var length = array ? array.length : 0;
7
-  return length ? baseFlatten(array, INFINITY) : [];
8
-}
9
-
10
-function baseFlatten(array, depth, isStrict, result) {
11
-  result || (result = []);
12
-  var index = -1, length = array.length;
13
-  while (++index < length) {
14
-    var value = array[index];
15
-    if (depth > 0 && isArrayLikeObject(value) &&
16
-        (isStrict || isArray(value) || isArguments(value))) {
17
-      if (depth > 1) {
18
-        // Recursively flatten arrays (susceptible to call stack limits).
19
-        baseFlatten(value, depth - 1, isStrict, result);
20
-      } else {
21
-        arrayPush(result, value);
22
-      }
23
-    } else if (!isStrict) {
24
-      result[result.length] = value;
25
-    }
26
-  }
27
-  return result;
28
-}
29
-
30
-function isArguments(value) {
31
-  // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.
32
-  return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
33
-    (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
34
-}
35
-
36
-var isArray = Array.isArray;
37
-
38
-function isArrayLikeObject(value) {
39
-  return isObjectLike(value) && isArrayLike(value);
40
-}
41
-
42
-function isObjectLike(value) {
43
-  return !!value && typeof value == 'object';
44
-}
45
-
46
-function isArrayLike(value) {
47
-  return value != null &&
48
-    !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));
49
-}
50
-
51
-function isFunction(value) {
52
-  // The use of `Object#toString` avoids issues with the `typeof` operator
53
-  // in Safari 8 which returns 'object' for typed array constructors, and
54
-  // PhantomJS 1.9 which returns 'function' for `NodeList` instances.
55
-  var tag = isObject(value) ? objectToString.call(value) : '';
56
-  return tag == funcTag || tag == genTag;
57
-}
58
-
59
-function isLength(value) {
60
-  return typeof value == 'number' &&
61
-    value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
62
-}
63
-
64
-var getLength = baseProperty('length');
65
-
66
-function baseProperty(key) {
67
-  return function(object) {
68
-    return object == null ? undefined : object[key];
69
-  };
70
-}
71
-
72
-function arrayPush(array, values) {
73
-  var index = -1, length = values.length, offset = array.length;
74
-  while (++index < length) {
75
-    array[offset + index] = values[index];
76
-  }
77
-  return array;
78
-}
79
-
80
-module.exports = {
81
-  flattenDeep: flattenDeep
82
-};

+ 0
- 6
src/deprecated/indexDeprecated.android.js Прегледај датотеку

@@ -1,6 +0,0 @@
1
-import Navigation from './../Navigation';
2
-
3
-module.exports = {
4
-  Navigation
5
-};
6
-

+ 0
- 8
src/deprecated/indexDeprecated.ios.js Прегледај датотеку

@@ -1,8 +0,0 @@
1
-import Navigation from './../Navigation';
2
-import {NavigationToolBarIOS} from './controllers';
3
-
4
-module.exports = {
5
-  Navigation,
6
-  NavigationToolBarIOS
7
-};
8
-

+ 0
- 76
src/deprecated/newParams.json Прегледај датотеку

@@ -1,76 +0,0 @@
1
-{
2
-	"screen":{
3
-		"screen":"example.FirstTabScreen",
4
-		"title":"Navigation",
5
-		"navigatorStyle":{
6
-			"navBarBackgroundColor":"#4dbce9",
7
-			"navBarTextColor":"#ffff00",
8
-			"navBarSubtitleTextColor":"#ff0000",
9
-			"navBarButtonColor":"#ffffff",
10
-			"statusBarTextColorScheme":"light",
11
-			"tabBarBackgroundColor":"#4dbce9",
12
-			"tabBarButtonColor":"#ffffff",
13
-			"tabBarSelectedButtonColor":"#ffff00"
14
-		},
15
-		"navigatorID":"navigatorID1_nav",
16
-		"screenInstanceID":"screenInstanceID2",
17
-		"navigatorEventID":"screenInstanceID2_events",
18
-		"navigatorButtons":{
19
-			"leftButtons":[
20
-				{
21
-					"icon":"http://localhost:8081/assets/img/navicon_menu@2x.png?platform=ios&hash=940519e495eac2a6236034f2bf88ce90",
22
-					"id":"menu"
23
-				}
24
-			],
25
-			"rightButtons":[
26
-				{
27
-					"title":"Edit",
28
-					"id":"edit",
29
-					"enabled":true
30
-				},
31
-				{
32
-					"icon":"http://localhost:8081/assets/img/navicon_add@2x.png?platform=ios&hash=667fefa47fb5daebbc3943669dc6eb26",
33
-					"id":"add",
34
-					"enabled":true
35
-				}
36
-			]
37
-		},
38
-		"screenId":"example.FirstTabScreen",
39
-		"styleParams":{
40
-			"topBarColor":4283284713,
41
-			"titleBarTitleColor":4294967040,
42
-			"titleBarButtonColor":4294967295,
43
-			"drawBelowTopBar":true,
44
-			"drawScreenAboveBottomTabs":true,
45
-			"bottomTabsColor":4283284713,
46
-			"bottomTabsButtonColor":4294967295,
47
-			"bottomTabsSelectedButtonColor":4294967040
48
-		},
49
-		"navigationParams":{
50
-			"screenInstanceID":"screenInstanceID2",
51
-			"navigatorID":"navigatorID1_nav",
52
-			"navigatorEventID":"screenInstanceID2_events"
53
-		}
54
-	},
55
-	"drawer":{
56
-		"left":{
57
-			"screen":"example.SideMenu"
58
-		}
59
-	},
60
-	"appStyle":null,
61
-	"sideMenu":{
62
-		"left":{
63
-			"screenId":"example.SideMenu",
64
-			"navigatorID":"navigatorID3_nav",
65
-			"screenInstanceID":"screenInstanceID4",
66
-			"navigatorEventID":"screenInstanceID4_events",
67
-			"navigationParams":{
68
-				"screenInstanceID":"screenInstanceID4",
69
-				"navigatorID":"navigatorID3_nav",
70
-				"navigatorEventID":"screenInstanceID4_events"
71
-			}
72
-		},
73
-		"right":null
74
-	},
75
-	"animateShow":true
76
-}

+ 0
- 563
src/deprecated/platformSpecificDeprecated.android.js Прегледај датотеку

@@ -1,563 +0,0 @@
1
-/*eslint-disable*/
2
-import React, {Component} from 'react';
3
-import {AppRegistry, NativeModules, processColor} from 'react-native';
4
-import _ from 'lodash';
5
-
6
-import Navigation from './../Navigation';
7
-
8
-const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
9
-
10
-import * as newPlatformSpecific from './../platformSpecific';
11
-
12
-function startSingleScreenApp(params) {
13
-  const screen = params.screen;
14
-  if (!screen.screen) {
15
-    console.error('startSingleScreenApp(params): screen must include a screen property');
16
-    return;
17
-  }
18
-  addNavigatorParams(screen);
19
-  addNavigatorButtons(screen, params.drawer);
20
-  addNavigationStyleParams(screen);
21
-  screen.passProps = params.passProps;
22
-
23
-  /*
24
-   * adapt to new API
25
-   */
26
-  adaptTopTabs(screen, screen.navigatorID);
27
-  screen.screenId = screen.screen;
28
-  params.screen = adaptNavigationStyleToScreenStyle(screen);
29
-  params.screen = adaptNavigationParams(screen);
30
-  params.appStyle = convertStyleParams(params.appStyle);
31
-  params.sideMenu = convertDrawerParamsToSideMenuParams(params.drawer);
32
-  params.overrideBackPress = screen.overrideBackPress;
33
-  params.animateShow = convertAnimationType(params.animationType);
34
-
35
-  newPlatformSpecific.startApp(params);
36
-}
37
-
38
-function adaptTopTabs(screen, navigatorID) {
39
-  screen.topTabs = _.cloneDeep(screen.topTabs);
40
-  _.forEach(_.get(screen, 'topTabs'), (tab) => {
41
-    addNavigatorParams(tab);
42
-    if (navigatorID) {
43
-      tab.navigatorID = navigatorID;
44
-    }
45
-    tab.screen = tab.screenId;
46
-    addNavigatorButtons(tab);
47
-    adaptNavigationParams(tab);
48
-    addNavigationStyleParams(tab);
49
-    tab = adaptNavigationStyleToScreenStyle(tab);
50
-  });
51
-}
52
-
53
-function navigatorPush(navigator, params) {
54
-  addNavigatorParams(params, navigator);
55
-  addNavigatorButtons(params);
56
-  addTitleBarBackButtonIfNeeded(params);
57
-  addNavigationStyleParams(params);
58
-
59
-  adaptTopTabs(params, params.navigatorID);
60
-
61
-  params.screenId = params.screen;
62
-  let adapted = adaptNavigationStyleToScreenStyle(params);
63
-  adapted = adaptNavigationParams(adapted);
64
-  adapted.overrideBackPress = params.overrideBackPress;
65
-
66
-  newPlatformSpecific.push(adapted);
67
-}
68
-
69
-function navigatorPop(navigator, params) {
70
-  addNavigatorParams(params, navigator);
71
-
72
-  params.screenId = params.screen;
73
-  let adapted = adaptNavigationStyleToScreenStyle(params);
74
-  adapted = adaptNavigationParams(adapted);
75
-
76
-  newPlatformSpecific.pop(adapted);
77
-}
78
-
79
-function navigatorPopToRoot(navigator, params) {
80
-  addNavigatorParams(params, navigator);
81
-
82
-  params.screenId = params.screen;
83
-  let adapted = adaptNavigationStyleToScreenStyle(params);
84
-  adapted = adaptNavigationParams(adapted);
85
-
86
-  newPlatformSpecific.popToRoot(adapted);
87
-}
88
-
89
-function navigatorResetTo(navigator, params) {
90
-  addNavigatorParams(params, navigator);
91
-  addNavigatorButtons(params);
92
-  addNavigationStyleParams(params);
93
-
94
-  adaptTopTabs(params, params.navigatorID);
95
-
96
-  params.screenId = params.screen;
97
-  let adapted = adaptNavigationStyleToScreenStyle(params);
98
-  adapted = adaptNavigationParams(adapted);
99
-
100
-  newPlatformSpecific.newStack(adapted);
101
-}
102
-
103
-function adaptNavigationStyleToScreenStyle(screen) {
104
-  const navigatorStyle = screen.navigatorStyle;
105
-  if (!navigatorStyle) {
106
-    return screen;
107
-  }
108
-
109
-  screen.styleParams = convertStyleParams(navigatorStyle);
110
-
111
-  return _.omit(screen, ['navigatorStyle']);
112
-}
113
-
114
-function convertStyleParams(originalStyleObject) {
115
-  if (!originalStyleObject) {
116
-    return null;
117
-  }
118
-
119
-  let ret = {
120
-    statusBarColor: processColor(originalStyleObject.statusBarColor),
121
-    topBarColor: processColor(originalStyleObject.navBarBackgroundColor),
122
-    topBarTransparent: originalStyleObject.navBarTransparent,
123
-    topBarTranslucent: originalStyleObject.navBarTranslucent,
124
-    topBarElevationShadowEnabled: originalStyleObject.topBarElevationShadowEnabled,
125
-    collapsingToolBarImage: originalStyleObject.collapsingToolBarImage,
126
-    collapsingToolBarCollapsedColor: processColor(originalStyleObject.collapsingToolBarCollapsedColor),
127
-    titleBarHidden: originalStyleObject.navBarHidden,
128
-    titleBarHideOnScroll: originalStyleObject.navBarHideOnScroll,
129
-    titleBarTitleColor: processColor(originalStyleObject.navBarTextColor),
130
-    titleBarSubtitleColor: processColor(originalStyleObject.navBarTextSubtitleColor),
131
-    titleBarButtonColor: processColor(originalStyleObject.navBarButtonColor),
132
-    titleBarDisabledButtonColor: processColor(originalStyleObject.titleBarDisabledButtonColor),
133
-    backButtonHidden: originalStyleObject.backButtonHidden,
134
-    topTabsHidden: originalStyleObject.topTabsHidden,
135
-    contextualMenuStatusBarColor: processColor(originalStyleObject.contextualMenuStatusBarColor),
136
-    contextualMenuBackgroundColor: processColor(originalStyleObject.contextualMenuBackgroundColor),
137
-    contextualMenuButtonsColor: processColor(originalStyleObject.contextualMenuButtonsColor),
138
-
139
-    drawBelowTopBar: !originalStyleObject.drawUnderNavBar,
140
-
141
-    topTabTextColor: processColor(originalStyleObject.topTabTextColor),
142
-    selectedTopTabTextColor: processColor(originalStyleObject.selectedTopTabTextColor),
143
-    selectedTopTabIndicatorHeight: originalStyleObject.selectedTopTabIndicatorHeight,
144
-    selectedTopTabIndicatorColor: processColor(originalStyleObject.selectedTopTabIndicatorColor),
145
-
146
-    screenBackgroundColor: processColor(originalStyleObject.screenBackgroundColor),
147
-
148
-    drawScreenAboveBottomTabs: !originalStyleObject.drawUnderTabBar,
149
-
150
-    bottomTabsColor: processColor(originalStyleObject.tabBarBackgroundColor),
151
-    bottomTabsButtonColor: processColor(originalStyleObject.tabBarButtonColor),
152
-    bottomTabsSelectedButtonColor: processColor(originalStyleObject.tabBarSelectedButtonColor),
153
-    bottomTabsHidden: originalStyleObject.tabBarHidden,
154
-    bottomTabsHiddenOnScroll: originalStyleObject.bottomTabsHiddenOnScroll,
155
-    forceTitlesDisplay: originalStyleObject.forceTitlesDisplay,
156
-    bottomTabBadgeTextColor: processColor(originalStyleObject.bottomTabBadgeTextColor),
157
-    bottomTabBadgeBackgroundColor: processColor(originalStyleObject.bottomTabBadgeBackgroundColor),
158
-
159
-    navigationBarColor: processColor(originalStyleObject.navigationBarColor)
160
-  }
161
-
162
-  if (originalStyleObject.collapsingToolBarImage) {
163
-    if (_.isString(originalStyleObject.collapsingToolBarImage)) {
164
-      ret.collapsingToolBarImage = originalStyleObject.collapsingToolBarImage;
165
-    }
166
-
167
-    const collapsingToolBarImage = resolveAssetSource(originalStyleObject.collapsingToolBarImage)
168
-    if (collapsingToolBarImage) {
169
-      ret.collapsingToolBarImage = collapsingToolBarImage.uri;
170
-    }
171
-  }
172
-  return ret;
173
-}
174
-
175
-function convertDrawerParamsToSideMenuParams(drawerParams) {
176
-  const drawer = Object.assign({}, drawerParams);
177
-
178
-  let result = {
179
-    left: {},
180
-    right: {}
181
-  };
182
-
183
-  Object.keys(result).forEach((key) => {
184
-    if (drawer[key] && drawer[key].screen) {
185
-      result[key].screenId = drawer[key].screen;
186
-      addNavigatorParams(result[key]);
187
-      result[key] = adaptNavigationParams(result[key]);
188
-      result[key].passProps = drawer[key].passProps;
189
-      result[key].disableOpenGesture = drawer.disableOpenGesture;
190
-    } else {
191
-      result[key] = null;
192
-    }
193
-  })
194
-
195
-  return result;
196
-}
197
-
198
-function adaptNavigationParams(screen) {
199
-  screen.navigationParams = {
200
-    screenInstanceID: screen.screenInstanceID,
201
-    navigatorID: screen.navigatorID,
202
-    navigatorEventID: screen.navigatorEventID
203
-  };
204
-  return screen;
205
-}
206
-
207
-function startTabBasedApp(params) {
208
-  if (!params.tabs) {
209
-    console.error('startTabBasedApp(params): params.tabs is required');
210
-    return;
211
-  }
212
-
213
-  const newTabs = [];
214
-
215
-  params.tabs = _.cloneDeep(params.tabs);
216
-
217
-  params.tabs.forEach(function(tab, idx) {
218
-    addNavigatorParams(tab, null, idx);
219
-    addNavigatorButtons(tab, params.drawer);
220
-    addNavigationStyleParams(tab);
221
-    addTabIcon(tab);
222
-    if (!tab.passProps) {
223
-      tab.passProps = params.passProps;
224
-    }
225
-
226
-    adaptTopTabs(tab, tab.navigatorID);
227
-
228
-    tab.screenId = tab.screen;
229
-
230
-    let newtab = adaptNavigationStyleToScreenStyle(tab);
231
-    newtab = adaptNavigationParams(tab);
232
-    newtab.overrideBackPress = tab.overrideBackPress;
233
-    newTabs.push(newtab);
234
-  });
235
-  params.tabs = newTabs;
236
-
237
-  params.appStyle = convertStyleParams(params.appStyle);
238
-  params.sideMenu = convertDrawerParamsToSideMenuParams(params.drawer);
239
-  params.animateShow = convertAnimationType(params.animationType);
240
-
241
-  newPlatformSpecific.startApp(params);
242
-}
243
-
244
-function addTabIcon(tab) {
245
-  if (tab.icon) {
246
-    const icon = resolveAssetSource(tab.icon);
247
-    if (icon) {
248
-      tab.icon = icon.uri;
249
-    }
250
-  }
251
-
252
-  if (!tab.icon) {
253
-    throw new Error("No icon defined for tab " + tab.screen);
254
-  }
255
-}
256
-
257
-function convertAnimationType(animationType) {
258
-  return animationType !== 'none';
259
-}
260
-
261
-function navigatorSetButtons(navigator, navigatorEventID, _params) {
262
-  const params = _.cloneDeep(_params);
263
-  if (params.rightButtons) {
264
-    params.rightButtons.forEach(function(button) {
265
-      button.enabled = !button.disabled;
266
-      if (button.icon) {
267
-        const icon = resolveAssetSource(button.icon);
268
-        if (icon) {
269
-          button.icon = icon.uri;
270
-        }
271
-      }
272
-    });
273
-  }
274
-  const leftButton = getLeftButton(params);
275
-  if (leftButton) {
276
-    if (leftButton.icon) {
277
-      const icon = resolveAssetSource(leftButton.icon);
278
-      if (icon) {
279
-        leftButton.icon = icon.uri;
280
-      }
281
-    }
282
-  }
283
-  const fab = getFab(params);
284
-  newPlatformSpecific.setScreenButtons(navigator.screenInstanceID, navigatorEventID, params.rightButtons, leftButton, fab);
285
-}
286
-
287
-function navigatorSetTabBadge(navigator, params) {
288
-  const badge = params.badge.toString();
289
-  if (params.tabIndex >= 0) {
290
-    newPlatformSpecific.setBottomTabBadgeByIndex(params.tabIndex, badge);
291
-  } else {
292
-    newPlatformSpecific.setBottomTabBadgeByNavigatorId(navigator.navigatorID, badge);
293
-  }
294
-}
295
-
296
-function navigatorSetTitle(navigator, params) {
297
-  newPlatformSpecific.setScreenTitleBarTitle(navigator.screenInstanceID, params.title);
298
-}
299
-
300
-function navigatorSetSubtitle(navigator, params) {
301
-  newPlatformSpecific.setScreenTitleBarSubtitle(navigator.screenInstanceID, params.subtitle);
302
-}
303
-
304
-function navigatorSwitchToTab(navigator, params) {
305
-  if (params.tabIndex >= 0) {
306
-    newPlatformSpecific.selectBottomTabByTabIndex(params.tabIndex);
307
-  } else {
308
-    newPlatformSpecific.selectBottomTabByNavigatorId(navigator.navigatorID);
309
-  }
310
-}
311
-
312
-function navigatorToggleDrawer(navigator, params) {
313
-  const animated = !(params.animated === false);
314
-  if (params.to) {
315
-    const visible = params.to === 'open';
316
-    newPlatformSpecific.setSideMenuVisible(animated, visible, params.side);
317
-  } else {
318
-    newPlatformSpecific.toggleSideMenuVisible(animated, params.side);
319
-  }
320
-}
321
-
322
-function navigatorToggleNavBar(navigator, params) {
323
-  const screenInstanceID = navigator.screenInstanceID;
324
-  const visible = params.to === 'shown';
325
-  const animated = !(params.animated === false);
326
-
327
-  newPlatformSpecific.toggleTopBarVisible(
328
-    screenInstanceID,
329
-    visible,
330
-    animated
331
-  );
332
-}
333
-
334
-function navigatorToggleTabs(navigator, params) {
335
-  const visibility = params.to === 'hidden';
336
-  const animated = !(params.animated === false);
337
-  newPlatformSpecific.toggleBottomTabsVisible(visibility, animated);
338
-}
339
-
340
-function showModal(params) {
341
-  addNavigatorParams(params);
342
-  addNavigatorButtons(params);
343
-  addTitleBarBackButtonIfNeeded(params);
344
-  addNavigationStyleParams(params);
345
-
346
-  /*
347
-   * adapt to new API
348
-   */
349
-  adaptTopTabs(params, params.navigatorID);
350
-  params.screenId = params.screen;
351
-  let adapted = adaptNavigationStyleToScreenStyle(params);
352
-  adapted = adaptNavigationParams(adapted);
353
-  adapted.overrideBackPress = params.overrideBackPress;
354
-
355
-  newPlatformSpecific.showModal(adapted);
356
-}
357
-
358
-function dismissModal() {
359
-  newPlatformSpecific.dismissTopModal();
360
-}
361
-
362
-function dismissAllModals(params) {
363
-  newPlatformSpecific.dismissAllModals();
364
-}
365
-
366
-function addNavigatorParams(screen, navigator = null, idx = '') {
367
-  screen.navigatorID = navigator ? navigator.navigatorID : _.uniqueId('navigatorID') + '_nav' + idx;
368
-  screen.screenInstanceID = _.uniqueId('screenInstanceID');
369
-  screen.navigatorEventID = screen.screenInstanceID + '_events';
370
-}
371
-
372
-function addNavigatorButtons(screen, sideMenuParams) {
373
-  const Screen = Navigation.getRegisteredScreen(screen.screen);
374
-  screen.navigatorButtons = _.cloneDeep(Screen.navigatorButtons);
375
-
376
-  // Get image uri from image id
377
-  const rightButtons = getRightButtons(screen);
378
-  if (rightButtons) {
379
-    rightButtons.forEach(function(button) {
380
-      button.enabled = !button.disabled;
381
-      if (button.icon) {
382
-        const icon = resolveAssetSource(button.icon);
383
-        if (icon) {
384
-          button.icon = icon.uri;
385
-        }
386
-      }
387
-    });
388
-  }
389
-
390
-  let leftButton = getLeftButton(screen);
391
-  if (sideMenuParams && !leftButton) {
392
-    leftButton = createSideMenuButton();
393
-  }
394
-  if (leftButton) {
395
-    if (leftButton.icon) {
396
-      const icon = resolveAssetSource(leftButton.icon);
397
-      if (icon) {
398
-        leftButton.icon = icon.uri;
399
-      }
400
-    }
401
-  }
402
-
403
-  const fab = getFab(screen);
404
-  if (fab) {
405
-    screen.fab = fab;
406
-  }
407
-
408
-  if (rightButtons) {
409
-    screen.rightButtons = rightButtons;
410
-  }
411
-  if (leftButton) {
412
-    screen.leftButton = leftButton;
413
-  }
414
-}
415
-
416
-function getFab(screen) {
417
-  let fab = screen.fab;
418
-  if (screen.navigatorButtons && screen.navigatorButtons.fab) {
419
-    fab = screen.navigatorButtons.fab;
420
-  }
421
-  if (fab === null || fab === undefined) {
422
-    return;
423
-  }
424
-  if (Object.keys(fab).length === 0 ) {
425
-    return {};
426
-  }
427
-
428
-  const collapsedIconUri = resolveAssetSource(fab.collapsedIcon);
429
-  if (!collapsedIconUri) {
430
-    return;
431
-  }
432
-  fab.collapsedIcon = collapsedIconUri.uri;
433
-  if (fab.expendedIcon) {
434
-    const expendedIconUri = resolveAssetSource(fab.expendedIcon);
435
-    if (expendedIconUri) {
436
-      fab.expendedIcon = expendedIconUri.uri;
437
-    }
438
-  }
439
-  if (fab.backgroundColor) {
440
-    fab.backgroundColor = processColor(fab.backgroundColor);
441
-  }
442
-
443
-  if (fab.actions) {
444
-    _.forEach(fab.actions, (action) => {
445
-      action.icon = resolveAssetSource(action.icon).uri;
446
-      return action;
447
-    });
448
-  }
449
-
450
-  return fab;
451
-}
452
-
453
-function createSideMenuButton() {
454
-  return {
455
-    id: "sideMenu"
456
-  };
457
-}
458
-
459
-function addTitleBarBackButtonIfNeeded(screen) {
460
-  const leftButton = getLeftButton(screen);
461
-  if (!leftButton) {
462
-    screen.leftButton = {
463
-      id: 'back'
464
-    }
465
-  }
466
-}
467
-
468
-function getLeftButton(screen) {
469
-  const leftButton = getLeftButtonDeprecated(screen);
470
-  if (leftButton) {
471
-    return leftButton;
472
-  }
473
-
474
-  if (screen.navigatorButtons && screen.navigatorButtons.leftButtons) {
475
-    return screen.navigatorButtons.leftButtons[0];
476
-  }
477
-
478
-  if (screen.leftButtons) {
479
-    if (_.isArray(screen.leftButtons)) {
480
-      return screen.leftButtons[0];
481
-    } else {
482
-      return screen.leftButtons;
483
-    }
484
-  }
485
-
486
-  return null;
487
-}
488
-
489
-function getLeftButtonDeprecated(screen) {
490
-  if (screen.navigatorButtons && screen.navigatorButtons.leftButton) {
491
-    return screen.navigatorButtons.leftButton;
492
-  }
493
-
494
-  return screen.leftButton;
495
-}
496
-
497
-function getRightButtons(screen) {
498
-  if (screen.navigatorButtons && screen.navigatorButtons.rightButtons) {
499
-    return screen.navigatorButtons.rightButtons;
500
-  }
501
-
502
-  return screen.rightButtons;
503
-}
504
-
505
-function addNavigationStyleParams(screen) {
506
-  const Screen = Navigation.getRegisteredScreen(screen.screen);
507
-  screen.navigatorStyle = Object.assign({}, screen.navigatorStyle, Screen.navigatorStyle);
508
-}
509
-
510
-function showSnackbar(navigator, params) {
511
-  return newPlatformSpecific.showSnackbar(params);
512
-}
513
-
514
-function showContextualMenu(navigator, params) {
515
-  const contextualMenu = {
516
-    buttons: [],
517
-    backButton: {id: 'back'},
518
-    navigationParams: {navigatorEventID: navigator.navigatorEventID}
519
-  };
520
-
521
-  params.rightButtons.forEach((button, index) => {
522
-    const btn = {
523
-      icon: resolveAssetSource(button.icon),
524
-      showAsAction: button.showAsAction,
525
-      color: processColor(button.color),
526
-      label: button.title,
527
-      index
528
-    };
529
-    if (btn.icon) {
530
-      btn.icon = btn.icon.uri;
531
-    }
532
-    contextualMenu.buttons.push(btn);
533
-  });
534
-
535
-  newPlatformSpecific.showContextualMenu(navigator.screenInstanceID, contextualMenu, params.onButtonPressed);
536
-}
537
-
538
-function dismissContextualMenu() {
539
-  newPlatformSpecific.dismissContextualMenu();
540
-}
541
-
542
-export default {
543
-  startTabBasedApp,
544
-  startSingleScreenApp,
545
-  navigatorPush,
546
-  navigatorPop,
547
-  navigatorPopToRoot,
548
-  navigatorResetTo,
549
-  showModal,
550
-  dismissModal,
551
-  dismissAllModals,
552
-  navigatorSetButtons,
553
-  navigatorSetTabBadge,
554
-  navigatorSetTitle,
555
-  navigatorSetSubtitle,
556
-  navigatorSwitchToTab,
557
-  navigatorToggleDrawer,
558
-  navigatorToggleTabs,
559
-  navigatorToggleNavBar,
560
-  showSnackbar,
561
-  showContextualMenu,
562
-  dismissContextualMenu
563
-};

+ 0
- 598
src/deprecated/platformSpecificDeprecated.ios.js Прегледај датотеку

@@ -1,598 +0,0 @@
1
-/*eslint-disable*/
2
-import Navigation from './../Navigation';
3
-import Controllers, {Modal, Notification} from './controllers';
4
-import _ from 'lodash';
5
-import PropRegistry from '../PropRegistry';
6
-import * as newPlatformSpecific from './../platformSpecific';
7
-
8
-const React = Controllers.hijackReact();
9
-const {
10
-  ControllerRegistry,
11
-  TabBarControllerIOS,
12
-  NavigationControllerIOS,
13
-  DrawerControllerIOS
14
-} = React;
15
-
16
-function startApp(layout) {
17
-	newPlatformSpecific.startApp(layout);
18
-}
19
-
20
-function startTabBasedApp(params) {
21
-  if (!params.tabs) {
22
-    console.error('startTabBasedApp(params): params.tabs is required');
23
-    return;
24
-  }
25
-
26
-  const controllerID = _.uniqueId('controllerID');
27
-  params.tabs.map(function(tab, index) {
28
-    const navigatorID = controllerID + '_nav' + index;
29
-    const screenInstanceID = _.uniqueId('screenInstanceID');
30
-    if (!tab.screen) {
31
-      console.error('startTabBasedApp(params): every tab must include a screen property, take a look at tab#' + (index + 1));
32
-      return;
33
-    }
34
-    const {
35
-      navigatorStyle,
36
-      navigatorButtons,
37
-      navigatorEventID
38
-    } = _mergeScreenSpecificSettings(tab.screen, screenInstanceID, tab);
39
-    tab.navigationParams = {
40
-      screenInstanceID,
41
-      navigatorStyle,
42
-      navigatorButtons,
43
-      navigatorEventID,
44
-      navigatorID
45
-    };
46
-  });
47
-
48
-  const Controller = Controllers.createClass({
49
-    render: function() {
50
-      if (!params.drawer || (!params.drawer.left && !params.drawer.right)) {
51
-        return this.renderBody();
52
-      } else {
53
-        const navigatorID = controllerID + '_drawer';
54
-        return (
55
-          <DrawerControllerIOS id={navigatorID}
56
-                               componentLeft={params.drawer.left ? params.drawer.left.screen : undefined}
57
-                               passPropsLeft={{navigatorID: navigatorID}}
58
-                               componentRight={params.drawer.right ? params.drawer.right.screen : undefined}
59
-                               passPropsRight={{navigatorID: navigatorID}}
60
-                               disableOpenGesture={params.drawer.disableOpenGesture}
61
-                               type={params.drawer.type ? params.drawer.type : 'MMDrawer'}
62
-                               animationType={params.drawer.animationType ? params.drawer.animationType : 'slide'}
63
-                               style={params.drawer.style}
64
-          >
65
-            {this.renderBody()}
66
-          </DrawerControllerIOS>
67
-        );
68
-      }
69
-    },
70
-    renderBody: function() {
71
-      return (
72
-        <TabBarControllerIOS
73
-          id={controllerID + '_tabs'}
74
-          style={params.tabsStyle}>
75
-          {
76
-            params.tabs.map(function(tab, index) {
77
-              return (
78
-                <TabBarControllerIOS.Item {...tab} title={tab.label}>
79
-                  <NavigationControllerIOS
80
-                    id={tab.navigationParams.navigatorID}
81
-                    title={tab.title}
82
-                    titleImage={tab.titleImage}
83
-                    component={tab.screen}
84
-                    passProps={{
85
-                    navigatorID: tab.navigationParams.navigatorID,
86
-                    screenInstanceID: tab.navigationParams.screenInstanceID,
87
-                    navigatorEventID: tab.navigationParams.navigatorEventID
88
-                  }}
89
-                    style={tab.navigationParams.navigatorStyle}
90
-                    leftButtons={tab.navigationParams.navigatorButtons.leftButtons}
91
-                    rightButtons={tab.navigationParams.navigatorButtons.rightButtons}
92
-                  />
93
-                </TabBarControllerIOS.Item>
94
-              );
95
-            })
96
-          }
97
-        </TabBarControllerIOS>
98
-      );
99
-    }
100
-  });
101
-  savePassProps(params);
102
-
103
-  ControllerRegistry.registerController(controllerID, () => Controller);
104
-  ControllerRegistry.setRootController(controllerID, params.animationType, params.passProps || {});
105
-}
106
-
107
-function startSingleScreenApp(params) {
108
-  if (!params.screen) {
109
-    console.error('startSingleScreenApp(params): params.screen is required');
110
-    return;
111
-  }
112
-
113
-  const controllerID = _.uniqueId('controllerID');
114
-  const screen = params.screen;
115
-  if (!screen.screen) {
116
-    console.error('startSingleScreenApp(params): screen must include a screen property');
117
-    return;
118
-  }
119
-
120
-  const navigatorID = controllerID + '_nav';
121
-  const screenInstanceID = _.uniqueId('screenInstanceID');
122
-  const {
123
-    navigatorStyle,
124
-    navigatorButtons,
125
-    navigatorEventID
126
-  } = _mergeScreenSpecificSettings(screen.screen, screenInstanceID, screen);
127
-  params.navigationParams = {
128
-    screenInstanceID,
129
-    navigatorStyle,
130
-    navigatorButtons,
131
-    navigatorEventID,
132
-    navigatorID
133
-  };
134
-
135
-  const Controller = Controllers.createClass({
136
-    render: function() {
137
-      if (!params.drawer || (!params.drawer.left && !params.drawer.right)) {
138
-        return this.renderBody();
139
-      } else {
140
-        const navigatorID = controllerID + '_drawer';
141
-        return (
142
-          <DrawerControllerIOS id={navigatorID}
143
-                               componentLeft={params.drawer.left ? params.drawer.left.screen : undefined}
144
-                               passPropsLeft={{navigatorID: navigatorID}}
145
-                               componentRight={params.drawer.right ? params.drawer.right.screen : undefined}
146
-                               passPropsRight={{navigatorID: navigatorID}}
147
-                               disableOpenGesture={params.drawer.disableOpenGesture}
148
-                               type={params.drawer.type ? params.drawer.type : 'MMDrawer'}
149
-                               animationType={params.drawer.animationType ? params.drawer.animationType : 'slide'}
150
-                               style={params.drawer.style}
151
-          >
152
-            {this.renderBody()}
153
-          </DrawerControllerIOS>
154
-        );
155
-      }
156
-    },
157
-    renderBody: function() {
158
-      return (
159
-        <NavigationControllerIOS
160
-          id={navigatorID}
161
-          title={screen.title}
162
-          subtitle={params.subtitle}
163
-          titleImage={screen.titleImage}
164
-          component={screen.screen}
165
-          passProps={{
166
-            navigatorID: navigatorID,
167
-            screenInstanceID: screenInstanceID,
168
-            navigatorEventID: navigatorEventID
169
-          }}
170
-          style={navigatorStyle}
171
-          leftButtons={navigatorButtons.leftButtons}
172
-          rightButtons={navigatorButtons.rightButtons}
173
-        />
174
-      );
175
-    }
176
-  });
177
-  savePassProps(params);
178
-
179
-  ControllerRegistry.registerController(controllerID, () => Controller);
180
-  ControllerRegistry.setRootController(controllerID, params.animationType, params.passProps || {});
181
-}
182
-
183
-function _mergeScreenSpecificSettings(screenID, screenInstanceID, params) {
184
-  const screenClass = Navigation.getRegisteredScreen(screenID);
185
-  if (!screenClass) {
186
-    console.error('Cannot create screen ' + screenID + '. Are you it was registered with Navigation.registerScreen?');
187
-    return;
188
-  }
189
-  const navigatorStyle = Object.assign({}, screenClass.navigatorStyle);
190
-  if (params.navigatorStyle) {
191
-    Object.assign(navigatorStyle, params.navigatorStyle);
192
-  }
193
-
194
-  let navigatorEventID = screenInstanceID + '_events';
195
-  let navigatorButtons = _.cloneDeep(screenClass.navigatorButtons);
196
-  if (params.navigatorButtons) {
197
-    navigatorButtons = _.cloneDeep(params.navigatorButtons);
198
-  }
199
-  if (navigatorButtons.leftButtons) {
200
-    for (let i = 0; i < navigatorButtons.leftButtons.length; i++) {
201
-      navigatorButtons.leftButtons[i].onPress = navigatorEventID;
202
-    }
203
-  }
204
-  if (navigatorButtons.rightButtons) {
205
-    for (let i = 0; i < navigatorButtons.rightButtons.length; i++) {
206
-      navigatorButtons.rightButtons[i].onPress = navigatorEventID;
207
-    }
208
-  }
209
-  return {navigatorStyle, navigatorButtons, navigatorEventID};
210
-}
211
-
212
-function navigatorPush(navigator, params) {
213
-  if (!params.screen) {
214
-    console.error('Navigator.push(params): params.screen is required');
215
-    return;
216
-  }
217
-  const screenInstanceID = _.uniqueId('screenInstanceID');
218
-  const {
219
-    navigatorStyle,
220
-    navigatorButtons,
221
-    navigatorEventID
222
-  } = _mergeScreenSpecificSettings(params.screen, screenInstanceID, params);
223
-  const passProps = Object.assign({}, params.passProps);
224
-  passProps.navigatorID = navigator.navigatorID;
225
-  passProps.screenInstanceID = screenInstanceID;
226
-  passProps.navigatorEventID = navigatorEventID;
227
-
228
-  params.navigationParams = {
229
-    screenInstanceID,
230
-    navigatorStyle,
231
-    navigatorButtons,
232
-    navigatorEventID,
233
-    navigatorID: navigator.navigatorID
234
-  };
235
-
236
-  savePassProps(params);
237
-
238
-  Controllers.NavigationControllerIOS(navigator.navigatorID).push({
239
-    title: params.title,
240
-    subtitle: params.subtitle,
241
-    titleImage: params.titleImage,
242
-    component: params.screen,
243
-    animated: params.animated,
244
-    passProps: passProps,
245
-    style: navigatorStyle,
246
-    backButtonTitle: params.backButtonTitle,
247
-    backButtonHidden: params.backButtonHidden,
248
-    leftButtons: navigatorButtons.leftButtons,
249
-    rightButtons: navigatorButtons.rightButtons
250
-  });
251
-}
252
-
253
-function navigatorPop(navigator, params) {
254
-  Controllers.NavigationControllerIOS(navigator.navigatorID).pop({
255
-    animated: params.animated
256
-  });
257
-}
258
-
259
-function navigatorPopToRoot(navigator, params) {
260
-  Controllers.NavigationControllerIOS(navigator.navigatorID).popToRoot({
261
-    animated: params.animated
262
-  });
263
-}
264
-
265
-function navigatorResetTo(navigator, params) {
266
-  if (!params.screen) {
267
-    console.error('Navigator.resetTo(params): params.screen is required');
268
-    return;
269
-  }
270
-  const screenInstanceID = _.uniqueId('screenInstanceID');
271
-  const {
272
-    navigatorStyle,
273
-    navigatorButtons,
274
-    navigatorEventID
275
-  } = _mergeScreenSpecificSettings(params.screen, screenInstanceID, params);
276
-  const passProps = Object.assign({}, params.passProps);
277
-  passProps.navigatorID = navigator.navigatorID;
278
-  passProps.screenInstanceID = screenInstanceID;
279
-  passProps.navigatorEventID = navigatorEventID;
280
-
281
-  params.navigationParams = {
282
-    screenInstanceID,
283
-    navigatorStyle,
284
-    navigatorButtons,
285
-    navigatorEventID,
286
-    navigatorID: navigator.navigatorID
287
-  };
288
-
289
-  savePassProps(params);
290
-
291
-  Controllers.NavigationControllerIOS(navigator.navigatorID).resetTo({
292
-    title: params.title,
293
-    subtitle: params.subtitle,
294
-    titleImage: params.titleImage,
295
-    component: params.screen,
296
-    animated: params.animated,
297
-    passProps: passProps,
298
-    style: navigatorStyle,
299
-    leftButtons: navigatorButtons.leftButtons,
300
-    rightButtons: navigatorButtons.rightButtons
301
-  });
302
-}
303
-
304
-function navigatorSetTitle(navigator, params) {
305
-  Controllers.NavigationControllerIOS(navigator.navigatorID).setTitle({
306
-    title: params.title,
307
-    subtitle: params.subtitle,
308
-    titleImage: params.titleImage,
309
-    style: params.navigatorStyle
310
-  });
311
-}
312
-
313
-function navigatorSetTitleImage(navigator, params) {
314
-  Controllers.NavigationControllerIOS(navigator.navigatorID).setTitleImage({
315
-    titleImage: params.titleImage
316
-  });
317
-}
318
-
319
-function navigatorToggleNavBar(navigator, params) {
320
-  Controllers.NavigationControllerIOS(navigator.navigatorID).setHidden({
321
-    hidden: ((params.to === 'hidden') ? true : false),
322
-    animated: params.animated
323
-  });
324
-}
325
-
326
-function navigatorToggleDrawer(navigator, params) {
327
-  const controllerID = navigator.navigatorID.split('_')[0];
328
-  if (params.to == 'open') {
329
-    Controllers.DrawerControllerIOS(controllerID + '_drawer').open({
330
-      side: params.side,
331
-      animated: params.animated
332
-    });
333
-  } else if (params.to == 'closed') {
334
-    Controllers.DrawerControllerIOS(controllerID + '_drawer').close({
335
-      side: params.side,
336
-      animated: params.animated
337
-    });
338
-  } else {
339
-    Controllers.DrawerControllerIOS(controllerID + '_drawer').toggle({
340
-      side: params.side,
341
-      animated: params.animated
342
-    });
343
-  }
344
-}
345
-
346
-function navigatorToggleTabs(navigator, params) {
347
-  const controllerID = navigator.navigatorID.split('_')[0];
348
-  Controllers.TabBarControllerIOS(controllerID + '_tabs').setHidden({
349
-    hidden: params.to == 'hidden',
350
-    animated: !(params.animated === false)
351
-  });
352
-}
353
-
354
-function navigatorSetTabBadge(navigator, params) {
355
-  const controllerID = navigator.navigatorID.split('_')[0];
356
-  if (params.tabIndex || params.tabIndex === 0) {
357
-    Controllers.TabBarControllerIOS(controllerID + '_tabs').setBadge({
358
-      tabIndex: params.tabIndex,
359
-      badge: params.badge
360
-    });
361
-  } else {
362
-    Controllers.TabBarControllerIOS(controllerID + '_tabs').setBadge({
363
-      contentId: navigator.navigatorID,
364
-      contentType: 'NavigationControllerIOS',
365
-      badge: params.badge
366
-    });
367
-  }
368
-}
369
-
370
-function navigatorSwitchToTab(navigator, params) {
371
-  const controllerID = navigator.navigatorID.split('_')[0];
372
-  if (params.tabIndex || params.tabIndex === 0) {
373
-    Controllers.TabBarControllerIOS(controllerID + '_tabs').switchTo({
374
-      tabIndex: params.tabIndex
375
-    });
376
-  } else {
377
-    Controllers.TabBarControllerIOS(controllerID + '_tabs').switchTo({
378
-      contentId: navigator.navigatorID,
379
-      contentType: 'NavigationControllerIOS'
380
-    });
381
-  }
382
-}
383
-
384
-function navigatorSetButtons(navigator, navigatorEventID, params) {
385
-  if (params.leftButtons) {
386
-    const buttons = params.leftButtons.slice(); // clone
387
-    for (let i = 0; i < buttons.length; i++) {
388
-      buttons[i].onPress = navigatorEventID;
389
-    }
390
-    Controllers.NavigationControllerIOS(navigator.navigatorID).setLeftButtons(buttons, params.animated);
391
-  }
392
-  if (params.rightButtons) {
393
-    const buttons = params.rightButtons.slice(); // clone
394
-    for (let i = 0; i < buttons.length; i++) {
395
-      buttons[i].onPress = navigatorEventID;
396
-    }
397
-    Controllers.NavigationControllerIOS(navigator.navigatorID).setRightButtons(buttons, params.animated);
398
-  }
399
-}
400
-
401
-function showModal(params) {
402
-  if (!params.screen) {
403
-    console.error('showModal(params): params.screen is required');
404
-    return;
405
-  }
406
-  const controllerID = _.uniqueId('controllerID');
407
-  const navigatorID = controllerID + '_nav';
408
-  const screenInstanceID = _.uniqueId('screenInstanceID');
409
-  const {
410
-    navigatorStyle,
411
-    navigatorButtons,
412
-    navigatorEventID
413
-  } = _mergeScreenSpecificSettings(params.screen, screenInstanceID, params);
414
-  const passProps = Object.assign({}, params.passProps);
415
-  passProps.navigatorID = navigatorID;
416
-  passProps.screenInstanceID = screenInstanceID;
417
-  passProps.navigatorEventID = navigatorEventID;
418
-
419
-  params.navigationParams = {
420
-    screenInstanceID,
421
-    navigatorStyle,
422
-    navigatorButtons,
423
-    navigatorEventID,
424
-    navigatorID: navigator.navigatorID
425
-  };
426
-
427
-  const Controller = Controllers.createClass({
428
-    render: function() {
429
-      return (
430
-        <NavigationControllerIOS
431
-          id={navigatorID}
432
-          title={params.title}
433
-          subtitle={params.subtitle}
434
-          titleImage={params.titleImage}
435
-          component={params.screen}
436
-          passProps={passProps}
437
-          style={navigatorStyle}
438
-          leftButtons={navigatorButtons.leftButtons}
439
-          rightButtons={navigatorButtons.rightButtons}/>
440
-      );
441
-    }
442
-  });
443
-
444
-  savePassProps(params);
445
-
446
-  ControllerRegistry.registerController(controllerID, () => Controller);
447
-  Modal.showController(controllerID, params.animationType);
448
-}
449
-
450
-function dismissModal(params) {
451
-  Modal.dismissController(params.animationType);
452
-}
453
-
454
-function dismissAllModals(params) {
455
-  Modal.dismissAllControllers(params.animationType);
456
-}
457
-
458
-function showLightBox(params) {
459
-  if (!params.screen) {
460
-    console.error('showLightBox(params): params.screen is required');
461
-    return;
462
-  }
463
-  const controllerID = _.uniqueId('controllerID');
464
-  const navigatorID = controllerID + '_nav';
465
-  const screenInstanceID = _.uniqueId('screenInstanceID');
466
-  const {
467
-    navigatorStyle,
468
-    navigatorButtons,
469
-    navigatorEventID
470
-  } = _mergeScreenSpecificSettings(params.screen, screenInstanceID, params);
471
-  const passProps = Object.assign({}, params.passProps);
472
-  passProps.navigatorID = navigatorID;
473
-  passProps.screenInstanceID = screenInstanceID;
474
-  passProps.navigatorEventID = navigatorEventID;
475
-
476
-  params.navigationParams = {
477
-    screenInstanceID,
478
-    navigatorStyle,
479
-    navigatorButtons,
480
-    navigatorEventID,
481
-    navigatorID
482
-  };
483
-
484
-  savePassProps(params);
485
-
486
-  Modal.showLightBox({
487
-    component: params.screen,
488
-    passProps: passProps,
489
-    style: params.style
490
-  });
491
-}
492
-
493
-function dismissLightBox(params) {
494
-  Modal.dismissLightBox();
495
-}
496
-
497
-function showInAppNotification(params) {
498
-  if (!params.screen) {
499
-    console.error('showInAppNotification(params): params.screen is required');
500
-    return;
501
-  }
502
-
503
-  const controllerID = _.uniqueId('controllerID');
504
-  const navigatorID = controllerID + '_nav';
505
-  const screenInstanceID = _.uniqueId('screenInstanceID');
506
-  const {
507
-    navigatorStyle,
508
-    navigatorButtons,
509
-    navigatorEventID
510
-  } = _mergeScreenSpecificSettings(params.screen, screenInstanceID, params);
511
-  const passProps = Object.assign({}, params.passProps);
512
-  passProps.navigatorID = navigatorID;
513
-  passProps.screenInstanceID = screenInstanceID;
514
-  passProps.navigatorEventID = navigatorEventID;
515
-
516
-  params.navigationParams = {
517
-    screenInstanceID,
518
-    navigatorStyle,
519
-    navigatorButtons,
520
-    navigatorEventID,
521
-    navigatorID
522
-  };
523
-
524
-  Notification.show({
525
-    component: params.screen,
526
-    passProps: passProps,
527
-    style: params.style,
528
-    animation: params.animation || Notification.AnimationPresets.default,
529
-    position: params.position,
530
-    shadowRadius: params.shadowRadius,
531
-    dismissWithSwipe: params.dismissWithSwipe || true,
532
-    autoDismissTimerSec: params.autoDismissTimerSec || 5
533
-  });
534
-}
535
-
536
-function dismissInAppNotification(params) {
537
-  Notification.dismiss(params);
538
-}
539
-
540
-function savePassProps(params) {
541
-  //TODO this needs to be handled in a common place,
542
-  //TODO also, all global passProps should be handled differently
543
-  if (params.navigationParams && params.passProps) {
544
-    PropRegistry.save(params.navigationParams.screenInstanceID, params.passProps);
545
-  }
546
-
547
-  if (params.screen && params.screen.passProps) {
548
-    PropRegistry.save(params.screen.navigationParams.screenInstanceID, params.screen.passProps);
549
-  }
550
-
551
-  if (_.get(params, 'screen.topTabs')) {
552
-    _.forEach(params.screen.topTabs, (tab) => savePassProps(tab));
553
-  }
554
-
555
-  if (params.tabs) {
556
-    _.forEach(params.tabs, (tab) => {
557
-      if (!tab.passProps) {
558
-        tab.passProps = params.passProps;
559
-      }
560
-      savePassProps(tab);
561
-    });
562
-  }
563
-}
564
-
565
-function showContextualMenu() {
566
-  // Android only
567
-}
568
-
569
-function dismissContextualMenu() {
570
-  // Android only
571
-}
572
-
573
-export default {
574
-  startApp,
575
-  startTabBasedApp,
576
-  startSingleScreenApp,
577
-  navigatorPush,
578
-  navigatorPop,
579
-  navigatorPopToRoot,
580
-  navigatorResetTo,
581
-  showModal,
582
-  dismissModal,
583
-  dismissAllModals,
584
-  showLightBox,
585
-  dismissLightBox,
586
-  showInAppNotification,
587
-  dismissInAppNotification,
588
-  navigatorSetButtons,
589
-  navigatorSetTitle,
590
-  navigatorSetTitleImage,
591
-  navigatorToggleDrawer,
592
-  navigatorToggleTabs,
593
-  navigatorSetTabBadge,
594
-  navigatorSwitchToTab,
595
-  navigatorToggleNavBar,
596
-  showContextualMenu,
597
-  dismissContextualMenu
598
-};

+ 0
- 1
src/index.js Прегледај датотеку

@@ -1 +0,0 @@
1
-module.exports = require('./deprecated/indexDeprecated');

+ 0
- 157
src/platformSpecific.android.js Прегледај датотеку

@@ -1,157 +0,0 @@
1
-import React, {Component} from 'react';
2
-import {AppRegistry, NativeModules} from 'react-native';
3
-import _ from 'lodash';
4
-import PropRegistry from './PropRegistry';
5
-
6
-const NativeReactModule = NativeModules.NavigationReactModule;
7
-
8
-function startApp(activityParams) {
9
-  savePassProps(activityParams);
10
-  NativeReactModule.startApp(activityParams);
11
-}
12
-
13
-function push(screenParams) {
14
-  savePassProps(screenParams);
15
-  NativeReactModule.push(screenParams);
16
-}
17
-
18
-function pop(screenParams) {
19
-  NativeReactModule.pop(screenParams);
20
-}
21
-
22
-function popToRoot(screenParams) {
23
-  NativeReactModule.popToRoot(screenParams);
24
-}
25
-
26
-function newStack(screenParams) {
27
-  savePassProps(screenParams);
28
-  NativeReactModule.newStack(screenParams);
29
-}
30
-
31
-function toggleTopBarVisible(screenInstanceID, visible, animated) {
32
-  NativeReactModule.setTopBarVisible(screenInstanceID, visible, animated);
33
-}
34
-
35
-function toggleBottomTabsVisible(visible, animated) {
36
-  NativeReactModule.setBottomTabsVisible(visible, animated);
37
-}
38
-
39
-function setScreenTitleBarTitle(screenInstanceID, title) {
40
-  NativeReactModule.setScreenTitleBarTitle(screenInstanceID, title);
41
-}
42
-
43
-function setScreenTitleBarSubtitle(screenInstanceID, subtitle) {
44
-  NativeReactModule.setScreenTitleBarSubtitle(screenInstanceID, subtitle);
45
-}
46
-
47
-function setScreenButtons(screenInstanceID, navigatorEventID, rightButtons, leftButton, fab) {
48
-  NativeReactModule.setScreenButtons(screenInstanceID, navigatorEventID, rightButtons, leftButton, fab);
49
-}
50
-
51
-function showModal(screenParams) {
52
-  savePassProps(screenParams);
53
-  NativeReactModule.showModal(screenParams);
54
-}
55
-
56
-function dismissTopModal() {
57
-  NativeReactModule.dismissTopModal();
58
-}
59
-
60
-function dismissAllModals() {
61
-  NativeReactModule.dismissAllModals();
62
-}
63
-
64
-function savePassProps(params) {
65
-  if (params.navigationParams && params.passProps) {
66
-    PropRegistry.save(params.navigationParams.screenInstanceID, params.passProps);
67
-  }
68
-
69
-  if (params.screen && params.screen.passProps) {
70
-    PropRegistry.save(params.screen.navigationParams.screenInstanceID, params.screen.passProps);
71
-  }
72
-
73
-  if (_.get(params, 'screen.topTabs')) {
74
-    _.forEach(params.screen.topTabs, (tab) => savePassProps(tab));
75
-  }
76
-
77
-  if (params.topTabs) {
78
-    _.forEach(params.topTabs, (tab) => savePassProps(tab));
79
-  }
80
-
81
-  if (params.tabs) {
82
-    _.forEach(params.tabs, (tab) => {
83
-      if (!tab.passProps) {
84
-        tab.passProps = params.passProps;
85
-      }
86
-      savePassProps(tab);
87
-    });
88
-  }
89
-
90
-  if (params.sideMenu && params.sideMenu.left) {
91
-    PropRegistry.save(params.sideMenu.left.navigationParams.screenInstanceID, params.sideMenu.left.passProps);
92
-  }
93
-  if (params.sideMenu && params.sideMenu.right) {
94
-    PropRegistry.save(params.sideMenu.right.navigationParams.screenInstanceID, params.sideMenu.right.passProps);
95
-  }
96
-}
97
-
98
-function toggleSideMenuVisible(animated, side) {
99
-  NativeReactModule.toggleSideMenuVisible(animated, side);
100
-}
101
-
102
-function setSideMenuVisible(animated, visible, side) {
103
-  NativeReactModule.setSideMenuVisible(animated, visible, side);
104
-}
105
-
106
-function selectBottomTabByNavigatorId(navigatorId) {
107
-  NativeReactModule.selectBottomTabByNavigatorId(navigatorId);
108
-}
109
-
110
-function selectBottomTabByTabIndex(index) {
111
-  NativeReactModule.selectBottomTabByTabIndex(index);
112
-}
113
-
114
-function setBottomTabBadgeByIndex(index, badge) {
115
-  NativeReactModule.setBottomTabBadgeByIndex(index, badge);
116
-}
117
-
118
-function setBottomTabBadgeByNavigatorId(navigatorId, badge) {
119
-  NativeReactModule.setBottomTabBadgeByNavigatorId(navigatorId, badge);
120
-}
121
-
122
-function showSnackbar(params) {
123
-  NativeReactModule.showSnackbar(params);
124
-}
125
-
126
-function showContextualMenu(screenInstanceID, params, onButtonPressed) {
127
-  NativeReactModule.showContextualMenu(screenInstanceID, params, onButtonPressed);
128
-}
129
-
130
-function dismissContextualMenu(screenInstanceID) {
131
-  NativeReactModule.dismissContextualMenu(screenInstanceID);
132
-}
133
-
134
-module.exports = {
135
-  startApp,
136
-  push,
137
-  pop,
138
-  popToRoot,
139
-  newStack,
140
-  toggleTopBarVisible,
141
-  toggleBottomTabsVisible,
142
-  setScreenTitleBarTitle,
143
-  setScreenTitleBarSubtitle,
144
-  setScreenButtons,
145
-  showModal,
146
-  dismissTopModal,
147
-  dismissAllModals,
148
-  toggleSideMenuVisible,
149
-  setSideMenuVisible,
150
-  selectBottomTabByNavigatorId,
151
-  selectBottomTabByTabIndex,
152
-  setBottomTabBadgeByNavigatorId,
153
-  setBottomTabBadgeByIndex,
154
-  showSnackbar,
155
-  showContextualMenu,
156
-  dismissContextualMenu
157
-};

+ 0
- 15
src/platformSpecific.ios.js Прегледај датотеку

@@ -1,15 +0,0 @@
1
-import React, {Component} from 'react';
2
-import {AppRegistry, NativeModules} from 'react-native';
3
-import _ from 'lodash';
4
-import PropRegistry from './PropRegistry';
5
-
6
-const NativeAppMAnager = NativeModules.RCCManager;
7
-
8
-function startApp(layout) {
9
-	
10
-	NativeAppMAnager.startApp(layout);
11
-}
12
-
13
-module.exports = {
14
-	startApp
15
-};

+ 137
- 0
src2/Navigation.js Прегледај датотеку

@@ -51,3 +51,140 @@ export function popToRoot(params) {
51 51
 export function newStack(params) {
52 52
   //
53 53
 }
54
+
55
+// new work on src/Navigation:
56
+//+function startApp(layout) {
57
+//  +    return platformSpecific.startApp(layout);
58
+//  +}
59
+//+
60
+//+  startSingleScreenApp: startSingleScreenApp,
61
+//  +  startApp: startApp
62
+
63
+// new work on src/newParams.json:
64
+//
65
+//{
66
+//  "screen": {
67
+//  "screen": "example.FirstTabScreen",
68
+//    "title": "Navigation",
69
+//    "navigatorStyle": {
70
+//    "navBarBackgroundColor": "#4dbce9",
71
+//      "navBarTextColor": "#ffff00",
72
+//      "navBarSubtitleTextColor": "#ff0000",
73
+//      "navBarButtonColor": "#ffffff",
74
+//      "statusBarTextColorScheme": "light",
75
+//      "tabBarBackgroundColor": "#4dbce9",
76
+//      "tabBarButtonColor": "#ffffff",
77
+//      "tabBarSelectedButtonColor": "#ffff00"
78
+//  },
79
+//  "navigatorID": "navigatorID1_nav",
80
+//    "screenInstanceID": "screenInstanceID2",
81
+//    "navigatorEventID": "screenInstanceID2_events",
82
+//    "navigatorButtons": {
83
+//    "leftButtons": [
84
+//      {
85
+//        "icon": "http://localhost:8081/assets/img/navicon_menu@2x.png?platform=ios&hash=940519e495eac2a6236034f2bf88ce90",
86
+//        "id": "menu"
87
+//      }
88
+//    ],
89
+//      "rightButtons": [
90
+//      {
91
+//        "title": "Edit",
92
+//        "id": "edit",
93
+//        "enabled": true
94
+//      },
95
+//      {
96
+//        "icon": "http://localhost:8081/assets/img/navicon_add@2x.png?platform=ios&hash=667fefa47fb5daebbc3943669dc6eb26",
97
+//        "id": "add",
98
+//        "enabled": true
99
+//      }
100
+//    ]
101
+//  },
102
+//  "screenId": "example.FirstTabScreen",
103
+//    "styleParams": {
104
+//    "topBarColor": 4283284713,
105
+//      "titleBarTitleColor": 4294967040,
106
+//      "titleBarButtonColor": 4294967295,
107
+//      "drawBelowTopBar": true,
108
+//      "drawScreenAboveBottomTabs": true,
109
+//      "bottomTabsColor": 4283284713,
110
+//      "bottomTabsButtonColor": 4294967295,
111
+//      "bottomTabsSelectedButtonColor": 4294967040
112
+//  },
113
+//  "navigationParams": {
114
+//    "screenInstanceID": "screenInstanceID2",
115
+//      "navigatorID": "navigatorID1_nav",
116
+//      "navigatorEventID": "screenInstanceID2_events"
117
+//  }
118
+//},
119
+//  "drawer": {
120
+//  "left": {
121
+//    "screen": "example.SideMenu"
122
+//  }
123
+//},
124
+//  "appStyle": null,
125
+//  "sideMenu": {
126
+//  "left": {
127
+//    "screenId": "example.SideMenu",
128
+//      "navigatorID": "navigatorID3_nav",
129
+//      "screenInstanceID": "screenInstanceID4",
130
+//      "navigatorEventID": "screenInstanceID4_events",
131
+//      "navigationParams": {
132
+//      "screenInstanceID": "screenInstanceID4",
133
+//        "navigatorID": "navigatorID3_nav",
134
+//        "navigatorEventID": "screenInstanceID4_events"
135
+//    }
136
+//  },
137
+//  "right": null
138
+//},
139
+//  "animateShow": true
140
+//}
141
+
142
+// new work on platformSpecificDeprecated.ios.js:
143
+import Navigation from './../Navigation';
144
+//import Controllers, {Modal, Notification} from './controllers';
145
+//+import _ from 'lodash';
146
+//+import PropRegistry from '../PropRegistry';
147
+//+import * as newPlatformSpecific from './../platformSpecific';
148
+//+
149
+//const React = Controllers.hijackReact();
150
+//const {
151
+//  ControllerRegistry,
152
+//  TabBarControllerIOS,
153
+//  NavigationControllerIOS,
154
+//  DrawerControllerIOS
155
+//} = React;
156
+//-import _ from 'lodash';
157
+//
158
+//-import PropRegistry from '../PropRegistry';
159
+//+function startApp(layout) {
160
+//  +	newPlatformSpecific.startApp(layout);
161
+//  +}
162
+//
163
+//function startTabBasedApp(params) {
164
+//  if (!params.tabs) {
165
+//  @@ -566,6 +571,7 @@ function dismissContextualMenu() {
166
+//    }
167
+//
168
+//    export default {
169
+//    +  startApp,
170
+//    startTabBasedApp,
171
+//      startSingleScreenApp,
172
+//      navigatorPush,
173
+
174
+//new work on platformSpecific.ios.js:
175
+//-module.exports = {};
176
+//+import React, {Component} from 'react';
177
+//+import {AppRegistry, NativeModules} from 'react-native';
178
+//+import _ from 'lodash';
179
+//+import PropRegistry from './PropRegistry';
180
+//+
181
+//  +const NativeAppMAnager = NativeModules.RCCManager;
182
+//+
183
+//  +function startApp(layout) {
184
+//    +
185
+//      +	NativeAppMAnager.startApp(layout);
186
+//    +}
187
+//+
188
+//+module.exports = {
189
+//                  +	startApp
190
+//                  +};