X Tutup
The Wayback Machine - https://web.archive.org/web/20260214185722/https://github.com/NativeScript/NativeScript/pull/8791
Skip to content

[android] fragment transactions#8791

Merged
NathanWalker merged 11 commits intoNativeScript:release/8.1.0from
Akylas:feature/android_fragment_transition
Aug 10, 2021
Merged

[android] fragment transactions#8791
NathanWalker merged 11 commits intoNativeScript:release/8.1.0from
Akylas:feature/android_fragment_transition

Conversation

@farfromrefug
Copy link
Collaborator

This PR changes the behavior of android fragment transactions to use add instead of replace on forward navigation

It is a breaking change in the sense that it 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 side o this:

  • no more black views on navigation when using opengl (maps, ...)
  • navigation is faster, especially the navigation back! We dont need to recreate the page anymore. But navigation forward also gets faster as we dont unload the previous page anymore.
  • navigatedFrom event happens faster

This the default behavior used by most of the android native apps.

That way we dont “unload” and “load” fragments.
This fixes black screens and slow transitions with opengl or cameras

# Conflicts:
#	packages/core/ui/frame/fragment.transitions.android.ts
#	packages/core/ui/frame/frame-common.ts
#	packages/core/ui/frame/index.android.ts
@NathanaelA

This comment was marked as abuse.

@farfromrefug
Copy link
Collaborator Author

They are not related and do not fix the same issue.
The other one is about fragment released too soon and not following android lifecycle

@NathanaelA

This comment was marked as abuse.

@farfromrefug
Copy link
Collaborator Author

Merge whenever you want. Already using it in multiple prod apps from my fork ;)

@NathanWalker NathanWalker added the ready for test TSC needs to test this and confirm against live production apps and automated test suites label Oct 27, 2020
@farfromrefug
Copy link
Collaborator Author

@NathanWalker i guess you are looking at those right? again jut want to confirm i have multiple productions app running this.

@farfromrefug
Copy link
Collaborator Author

@rigor789 @NathanaelA @NathanWalker Thanks to that PR and a new commit Akylas@a4d7674
I managed to make Maps work correctly with fragment transitions.
This is what we get today without that PR for GLSurfaceView. It is known that GLSurfaceView opacity cant be animated.
https://user-images.githubusercontent.com/655344/108607902-a345a700-73c3-11eb-82a8-aa143fb74a7b.mp4

This is what we get today without that PR for GLTextureView. There is "blink" on closing fragments with GLTextureView. It seems to happen only when using android Transition
https://user-images.githubusercontent.com/655344/108607939-ce2ffb00-73c3-11eb-9e7a-7b8eb8bb4f32.mp4

Now this is what i get with GLTextureView and this PR and the latest commit
https://user-images.githubusercontent.com/655344/108607967-f91a4f00-73c3-11eb-8969-b00b7835b664.mp4

Both the PR and the commit are needed to achieve this. I hope you are going to look at this.

@NathanWalker
Copy link
Contributor

@farfromrefug we are going to get this into 8.1 - there's only 1 conflicted file related to automated test, could you just resolve that one conflict and then we can merge into a 8.1 prep branch we are working through.

@NathanWalker NathanWalker added this to the 8.1 milestone Aug 6, 2021
@farfromrefug
Copy link
Collaborator Author

@NathanWalker great to hear. Will fix it on monday. Soon enough?

@NathanWalker
Copy link
Contributor

Absolutely thank you!

@NathanWalker NathanWalker changed the base branch from master to release/8.1.0 August 10, 2021 20:37
@NathanWalker NathanWalker merged commit e498c9d into NativeScript:release/8.1.0 Aug 10, 2021
rigor789 pushed a commit that referenced this pull request Aug 11, 2021
…' 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
rigor789 added a commit that referenced this pull request Aug 11, 2021
…'replace' on fwd navigation (#8791)

This reverts commit e498c9d.
NathanWalker pushed a commit that referenced this pull request Sep 8, 2021
…' 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
NathanWalker pushed a commit that referenced this pull request Sep 8, 2021
vallemar added a commit to vallemar/flash-map that referenced this pull request Oct 14, 2022
@vallemar
Copy link
Contributor

vallemar commented Nov 3, 2022

I think it would be important to review this pr since it was reverted, the views with maps emit a flash with the navigation back

This was discussed here: https://discord.com/channels/603595811204366337/751068755206864916/1030417807768297482 there are now more changes to make this work

@Siergiej29
Copy link

After all these years, there's still nothing new on this topic. Maybe it would be worth implementing this ready-made solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes ready for test TSC needs to test this and confirm against live production apps and automated test suites

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

X Tutup