67 Commits

Author SHA1 Message Date
a17b963182 fix(react): replacing route uses new route direction and animation (#28671)
Issue number: resolves #24260

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?

When replacing a route (`router.push(newRoute, 'none', 'replace')`) the
`RouterDirection` from the route being replaced is being used (if it
exists) instead of the new one the user specifies.

## What is the new behavior?

User-specified `RouteDirection` is used, if it exists. If it doesn't it
falls back to the `RouteDirection` of the route being replaced.

## Does this introduce a breaking change?

- [ ] Yes
- [X] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

Please see the following comment for why I think the current behavior is
incorrect, and why this change is needed:
https://github.com/ionic-team/ionic-framework/issues/24260#issuecomment-1078960780

---------

Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
2023-12-11 21:09:41 +00:00
fc88613fef fix(react): use custom animation when going back after a replace (#28674)
Issue number: resolves #28673

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

When reviewing https://github.com/ionic-team/ionic-framework/pull/28671
I noticed a bug where the custom animation was not used when going back
after a replace.

`handleNavigate` will override whatever is in `incomingRouteParams`.
Since we were passing `routeAnimation` (which is `undefined`), it was
overriding the animation we set in `handleNavigateBack`.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- `routeAnimation` is no longer overridden

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Dev build: `7.6.1-dev.11702048520.13c82dad`
2023-12-11 17:31:27 +00:00
1705d064cc fix(react): router creates new view instances of parameterized routes (#28616)
Issue number: Resolves #26524 

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## Definitions

**Parameterized routes**: A route that includes one or more variables in
the path segments, such as `/form/:index`.

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

When an application routes from a parameterized route, to an
intermediary route, to the same parameterized route, but with a
different value/url, Ionic's routing logic is incorrectly reusing the
view item from the first instance of the parameterized route instead of
calculating that the matched path is different. This results in the
wrong view item being recycled and rendered.

Another way of representing it:
- User navigates to `/form/0` which resolves `FormPage`
- User enters `0` into the form and submits the form
- User navigates to `/link`, which resolves `LinkPage`
- User navigates to `/form/1`, which resolves `FormPage`
- However, instead of creating a new instance of `FormPage` it is
reusing the instance of `FormPage` from `/form/0` which includes the
form having `0` in the input.
  - The user now sees a "new view", but with cached data in the form.

This is not expected or desired. 


## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Ionic's routing logic will validate if the entering view item matches
the match route data before reusing it. This results in new instances of
the view item being constructed when using parameterized routes.


https://github.com/ionic-team/ionic-framework/assets/13732623/e7e3d03f-2848-4429-9f60-9074d0761e45


## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Dev-build: `7.5.8-dev.11701383555.17254408`
2023-12-01 22:11:41 +00:00
824033f1d4 fix(react, vue): custom animations are used when going back (#27895)
Issue number: resolves #27873

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Custom animations are not always used when the `handleNavigateBack`
method is called. This impacts both Ionic React and Ionic Vue.

While we do set the `incomingRouteParams` with the animation:
a08a5894ba/packages/react-router/src/ReactRouter/IonRouter.tsx (L247-L252)

We do sometimes call `handleNavigate`:
a08a5894ba/packages/react-router/src/ReactRouter/IonRouter.tsx (L273-L279)

This `handleNavigate` method sets `incomingRouteParams` again:
a08a5894ba/packages/react-router/src/ReactRouter/IonRouter.tsx (L225-L230)

Since we do not re-pass `routeAnimation`, that field gets set to
`undefined` and the custom animation does not get used.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Custom animation is now passed to `handleNavigate`

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Dev build: `7.2.2-dev.11690810887.180000d1`
2023-07-31 17:57:03 +00:00
19c53c471b chore(react,react-router): bump typescript dev dependency to v4 (#27348)
Issue number: N/A

---------

<!-- Please refer to our contributing documentation for any questions on
submitting a pull request, or let us know here if you need any help:
https://ionicframework.com/docs/building/contributing -->

<!-- Some docs updates need to be made in the `ionic-docs` repo, in a
separate PR. See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation
for details. -->

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Both react and the react-router packages are on v3 of Typescript. 

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Updates the react and reac-router package to a minimum dev-dependency
of Typescript 4.0.5 (aligning with core)
- Fixes a conflict with the react router types when upgrading to v4 of
Typescript

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2023-05-02 14:30:46 +00:00
e8fb9e7328 chore(): sync with main 2023-01-23 13:38:16 -05:00
6d4c52aa5b chore(react-router): migrate to eslint, add prettier (#26634) 2023-01-18 17:22:16 -05:00
c2e1ad385d chore(many): replace any types and add tech debt tickets (#26293)
Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
2023-01-06 09:34:55 -06:00
c149b42d0b Merge remote-tracking branch 'origin/main' into sync-7-11-15-22 2022-11-15 15:40:21 -05:00
e3ef932ae1 chore(many): add tech debt tickets and remove unnecessary todos (#26266) 2022-11-14 14:49:08 -06:00
30e3a1485d perf(many): reduce delay when performing overlay or page transitions (#26189)
resolves #24346
2022-11-01 13:08:27 -04:00
a39d776f08 fix(react): duplicate page transitions do not happen on react 18 (#25798)
resolves #25797
2022-08-23 14:19:38 -04:00
3878bf7652 fix(react): outlet will not clear in react 18 with hot reload (#25703)
Resolves #25507
2022-08-03 16:33:26 -04:00
7ec3683e94 fix(react): swipe to go back gesture works on ios (#25563)
resolves #22342

Co-authored-by: masonicboom <masonicboom@users.noreply.github.com>
2022-07-19 09:28:10 -04:00
43aa6c11f4 fix(react): nested router outlets will not reanimate entered views (#24672)
Resolves #24107
2022-01-31 11:55:08 -05:00
bdb5c421d2 fix(react-router): remove page transition flicker on outlet mounting (#24667)
Resolves #24666
2022-01-27 16:29:52 -05:00
c50d895370 feat(react): add custom elements bundle (#23896) 2021-09-13 14:53:28 -04:00
36bfa33503 fix(react): remove @ionic/core dependency in @ionic/react-router to resolve yarn install warning (#23351)
resolves #23346
2021-05-24 10:32:33 -04:00
4da5216b4f fix(react): support history@5 in preparation for react router 6 (#23297)
resolves #23294
2021-05-14 09:03:15 -04:00
7203190234 fix(react, vue): correct view now chosen when going back inside tabs (#23154)
resolves #23087
resolves #23101
2021-04-06 10:16:23 -04:00
1c93b75e39 fix(react): correctly show ion-back-button when going back (#23069)
resolves #22692
2021-03-22 16:11:45 -04:00
943e3f6ae3 fix(react, vue): tab buttons no longer throw an error if href is undefined (#22998)
resolves #22997
2021-03-02 10:05:59 -05:00
cd8ffd82a0 fix(react, vue): navigating using ion-back-button now selects correct page (#22974)
resolves #22830
2021-02-25 13:18:20 -05:00
9e9a372497 fix(react, vue): do not show back button when replacing to root page (#22750)
resolves #22528
2021-01-13 10:10:44 -05:00
f891f66708 fix(react): improve view matching logic (#22569) 2020-12-15 11:03:08 -05:00
91aaaab71a chore(react): adding prettier and formating files 2020-12-07 09:31:33 -07:00
36939e10ae fix(react): android hardware button should invoke browser back 2020-12-07 08:33:00 -07:00
74632fa960 chore(react): fixing issue with new history types (#22109) 2020-09-17 16:03:33 -06:00
74af3cb50b fix(react): Keep a hold of previous routes when doing a redirect, closes #22053 2020-09-08 19:58:00 -06:00
4090250da7 chore(react): fixing lint errors 2020-09-08 09:36:44 -06:00
b11e06cec1 fix(react): redirect routes should unmount leaving component, fixes #22022 (#22029) 2020-09-04 14:56:20 -06:00
a15cd01bc3 fix(react): fixes swipe to go back regression (#21791) 2020-07-21 22:30:44 -06:00
f4a08b7ed4 fix(react): fixng ion-router-outlet ref regresssion (#21786) 2020-07-21 08:48:25 -06:00
d4a5fbd955 fix(react): adding custom history to IonReactRouter, closes #20297 (#21775) 2020-07-20 10:03:35 -06:00
81ef3f1ecd fix(react): fix regression with history.replace in new react router (#21698) 2020-07-08 10:22:08 -06:00
c171ccbd37 feat(react): React Router Enhancements (#21693) 2020-07-07 12:02:05 -05:00
3821c0463a feat(): add ability to continue processing hardware back button events (#20613)
fixes #17824
2020-04-27 12:58:37 -04:00
1b11ff7fb9 feat(back-button): add 'backButtonDefaultHref' property to Ionic Config (#20491)
closes #19305

Co-authored-by: Brandy Carney <brandy@ionic.io>
2020-04-27 10:57:43 -04:00
c0aadd6007 fix(react): Do a better job matching up route to sync, fixes #20363 (#20446) 2020-02-14 13:36:30 -07:00
b6fbe98812 fix(react): dont remove pages when navigating between tabs, fixes #20398 (#20431) 2020-02-14 13:36:30 -07:00
5d8e0ed703 fix(react): remove leaving view when routerdirection is back, fixes #20124 (#20268) 2020-01-23 13:10:29 -07:00
85be000a4c fix(react): support routes without a path for notfound routes, fixes #20259 (#20261) 2020-01-23 13:10:29 -07:00
28aa5eed94 chore(react): updating types for location state to fix type errors (#20207) 2020-01-14 12:49:58 -07:00
57eec1cb0a fix(react): add missing react memory router 2020-01-13 10:12:07 -07:00
2dcf3ee7b5 fix(react): fire lifecycle events on initial render, fixes #20071 2019-12-12 15:50:52 -07:00
4d226b05c6 fix(react): support for 'root' router direction, fixes #19982 (#20052) 2019-12-11 09:30:16 -07:00
43712db1be fix(react): first render performance improvements 2019-12-11 09:30:16 -07:00
b8517781b1 fix(react): don't show back button when not appropriate 2019-12-11 09:30:16 -07:00
693ae21096 fix(react): support navigating to same page and route updates in IonRouterOutlet, fixes #19891, #19892, #19986 2019-12-11 09:30:15 -07:00
ab0f92e01f fix(react): fix refs for controllers, overlays, ionpage, and ionrouteroutlet, fixes #19924 (#20012) 2019-12-11 09:30:15 -07:00