@ionic/react-router 9.0.6-dev.11790280751.1fc334cc → 9.0.6-dev.11790349282.1a877abd

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2546,17 +2546,17 @@ class StackManager extends React.PureComponent {
2546
2546
  const { routeInfo } = this.props;
2547
2547
  const swipeBackRouteInfo = this.getSwipeBackRouteInfo();
2548
2548
  const enteringViewItem = this.findEnteringViewForSwipe(swipeBackRouteInfo);
2549
+ const leavingViewItem = this.context.findViewItemByRouteInfo(routeInfo, this.id, false);
2549
2550
  // View might have mount=false but ionPageElement still in DOM
2550
2551
  const ionPageInDocument = Boolean(enteringViewItem?.ionPageElement && document.body.contains(enteringViewItem.ionPageElement));
2551
- // For wildcard/parameterized routes, the pattern path (e.g. "/foo/*") will
2552
- // never equal the resolved pathname (e.g. "/foo/bar"), so the pattern check
2553
- // alone isn't sufficient. Also, verify the entering view's resolved pathname
2554
- // differs from the current pathname — if they match, the entering and leaving
2555
- // views are the same and the swipe gesture shouldn't start.
2552
+ // A splat consumes whatever is left of the pathname, so its match resolves to the whole
2553
+ // current pathname and comparing pathnames can't tell a container page underneath a
2554
+ // pushed sibling from the page being left. Compare the view items instead, like onEnd
2555
+ // does. Without a leaving view onStart skips the transition, so reject that here too.
2556
2556
  const canStartSwipe = !!enteringViewItem &&
2557
+ !!leavingViewItem &&
2557
2558
  (enteringViewItem.mount || ionPageInDocument) &&
2558
- enteringViewItem.routeData.match.pattern.path !== routeInfo.pathname &&
2559
- enteringViewItem.routeData.match.pathname !== routeInfo.pathname;
2559
+ enteringViewItem !== leavingViewItem;
2560
2560
  debug('SwipeBackCanStart', () => ({
2561
2561
  outletId: this.id,
2562
2562
  routePathname: routeInfo.pathname,
@@ -2565,6 +2565,7 @@ class StackManager extends React.PureComponent {
2565
2565
  enteringViewPath: enteringViewItem?.reactElement?.props?.path,
2566
2566
  enteringMount: enteringViewItem?.mount,
2567
2567
  ionPageInDocument,
2568
+ leavingViewId: leavingViewItem?.id,
2568
2569
  canStartSwipe,
2569
2570
  }));
2570
2571
  return canStartSwipe;