feat(android): fragment transactions to use 'add' instead of 'replace' on fwd navigation (#8791)

Changes the behavior of android fragment transactions to use `add` instead of `replace` on forward navigation.

BREAKING CHANGE:

Changes the internal behavior of Android navigation:

* while navigating forward, the page navigated from is not unloaded anymore
* events order is changed in the sense that now `unloaded` happens after `navigatedFrom` instead of before

There are multiple plus sides to this:

* no more black views on navigation when using opengl (maps, ...)
* navigation is faster, especially the navigation back! No longer need to recreate the page anymore. Navigation forward also gets faster as we no longer unload the previous page
* navigatedFrom event happens faster
* this the default behavior used by most of the android native apps
This commit is contained in:
farfromrefuge
2021-08-10 22:42:25 +02:00
committed by Nathan Walker
parent 1e3bc48737
commit e17e46974b
4 changed files with 52 additions and 14 deletions

View File

@@ -181,7 +181,7 @@ function _test_PageNavigation_EventSequence(withTransition: boolean) {
helper.navigateWithEntry(navigationEntry);
helper.goBack();
const expectedEventSequence = ['navigatingTo', 'loaded', 'navigatedTo', 'navigatingFrom', 'unloaded', 'navigatedFrom'];
const expectedEventSequence = ['navigatingTo', 'loaded', 'navigatedTo', 'navigatingFrom', 'navigatedFrom', 'unloaded'];
TKUnit.arrayAssert(eventSequence, expectedEventSequence, 'Actual event sequence is not equal to expected. Actual: ' + eventSequence + '; Expected: ' + expectedEventSequence);
}