Browse Source

throttling calls to pushes, pops etc

Daniel Zlotin 8 years ago
parent
commit
541a6d09e0
2 changed files with 13 additions and 13 deletions
  1. 9
    9
      src/Navigation.js
  2. 4
    4
      src/Screen.js

+ 9
- 9
src/Navigation.js View File

@@ -106,13 +106,13 @@ export default {
106 106
   registerScreen,
107 107
   getRegisteredScreen,
108 108
   registerComponent,
109
-  showModal: _.throttle(showModal, 500, {leading: true, trailing: false}),
110
-  dismissModal: _.throttle(dismissModal, 500, {leading: true, trailing: false}),
111
-  dismissAllModals: _.throttle(dismissAllModals, 500, {leading: true, trailing: false}),
112
-  showLightBox: _.throttle(showLightBox, 500, {leading: true, trailing: false}),
113
-  dismissLightBox: _.throttle(dismissLightBox, 500, {leading: true, trailing: false}),
114
-  showInAppNotification: _.throttle(showInAppNotification, 500, {leading: true, trailing: false}),
115
-  dismissInAppNotification: _.throttle(dismissInAppNotification, 500, {leading: true, trailing: false}),
116
-  startTabBasedApp: _.throttle(startTabBasedApp, 500, {leading: true, trailing: false}),
117
-  startSingleScreenApp: _.throttle(startSingleScreenApp, 500, {leading: true, trailing: false})
109
+  showModal: _.throttle(showModal, 1000, {leading: true, trailing: false}),
110
+  dismissModal: dismissModal,
111
+  dismissAllModals: dismissAllModals,
112
+  showLightBox: _.throttle(showLightBox, 1000, {leading: true, trailing: false}),
113
+  dismissLightBox: dismissLightBox,
114
+  showInAppNotification: showInAppNotification,
115
+  dismissInAppNotification: dismissInAppNotification,
116
+  startTabBasedApp: _.throttle(startTabBasedApp, 1000, {leading: true, trailing: false}),
117
+  startSingleScreenApp: _.throttle(startSingleScreenApp, 1000, {leading: true, trailing: false})
118 118
 };

+ 4
- 4
src/Screen.js View File

@@ -11,10 +11,10 @@ import _ from 'lodash';
11 11
 const _allNavigatorEventHandlers = {};
12 12
 
13 13
 const throttledPlatformSpecificFunctions = {
14
-  push: _.throttle(platformSpecific.navigatorPush, 500, {leading: true, trailing: false}),
15
-  pop: _.throttle(platformSpecific.navigatorPop, 500, {leading: true, trailing: false}),
16
-  popToRoot: _.throttle(platformSpecific.navigatorPopToRoot, 500, {leading: true, trailing: false}),
17
-  resetTo: _.throttle(platformSpecific.navigatorResetTo, 500, {leading: true, trailing: false})
14
+  push: _.throttle(platformSpecific.navigatorPush, 1000, {leading: true, trailing: false}),
15
+  pop: _.throttle(platformSpecific.navigatorPop, 100, {leading: true, trailing: false}),
16
+  popToRoot: _.throttle(platformSpecific.navigatorPopToRoot, 100, {leading: true, trailing: false}),
17
+  resetTo: _.throttle(platformSpecific.navigatorResetTo, 100, {leading: true, trailing: false})
18 18
 };
19 19
 
20 20
 class Navigator {