@@ -75,6 +75,8 @@ export default (
75
75
paths [ routeName ] = { re, keys, toPath : pathToRegexp . compile ( pathPattern ) } ;
76
76
} ) ;
77
77
78
+ let inProgressNavigationRouteName = null ;
79
+
78
80
return {
79
81
getComponentForState ( state : NavigationState ) : NavigationComponent {
80
82
const activeChildRoute = state . routes [ state . index ] ;
@@ -141,6 +143,26 @@ export default (
141
143
} ;
142
144
}
143
145
146
+ if ( passedAction . type === 'Navigation/BACK' ) {
147
+ inProgressNavigationRouteName = null ;
148
+ }
149
+
150
+ if (
151
+ action . type === NavigationActions . NAVIGATE &&
152
+ passedAction . routeName !== 'DrawerOpen' &&
153
+ passedAction . routeName !== 'DrawerClose'
154
+ ) {
155
+ // Check if action wants to route to the route that is in-progress navigating
156
+ if (
157
+ inProgressNavigationRouteName !== null &&
158
+ inProgressNavigationRouteName === passedAction . routeName
159
+ ) {
160
+ inProgressNavigationRouteName = null ;
161
+ return ;
162
+ }
163
+ inProgressNavigationRouteName = passedAction . routeName ;
164
+ }
165
+
144
166
// Check if a child scene wants to handle the action as long as it is not a reset to the root stack
145
167
if ( action . type !== NavigationActions . RESET || action . key !== null ) {
146
168
const keyIndex = action . key
@@ -222,6 +244,7 @@ export default (
222
244
}
223
245
224
246
if ( action . type === NavigationActions . SET_PARAMS ) {
247
+ inProgressNavigationRouteName = null ;
225
248
const lastRoute = state . routes . find (
226
249
/* $FlowFixMe */
227
250
( route : * ) => route . key === action . key
@@ -273,6 +296,7 @@ export default (
273
296
274
297
if ( action . type === NavigationActions . BACK ) {
275
298
let backRouteIndex = null ;
299
+ inProgressNavigationRouteName = null ;
276
300
if ( action . key ) {
277
301
const backRoute = state . routes . find (
278
302
/* $FlowFixMe */
0 commit comments