Skip to content

feat(android): allow shared element transition to work with ListView/CollectionView/Pager #10411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 24, 2023

Conversation

farfromrefug
Copy link
Collaborator

In the current implementation it would not work because the collectionview would not have time to realize the cells which you would want to use as shared element.

The idea is to defer a bit for :

  • the page to be loaded
  • a timeout giving time to the collectionview to realize its "cells". In most my case the 0 timeout was enough, though for some reason i did not find yet it requires just a bit more with the pager. So what i did is make the timeout a parameter of the PageTransition so that each use case can be handled.

A few notes :

  • i left the old commented code for now to be able to compare
  • presenting and presented can not be "compared" anymore. We cant filter on intersection. Though it is not a big deal. Android handles that on its own.
  • i am starting to think it would be best for PageTransition constructor parameters to be an object. Would be less messy, though it would be a breaking change. But as it is quite a new feature, would that be acceptable?
  • in my fork the PageTransition has a onTransitionEnd which revert setTransitionName to null for all presenting views. The reason is that my fork uses add for fragments instead of replace. Thus back navigation fragments are still existing. And if you use the same setTransitionName for multiple pages in deep navigation it would fail/crash. I did not add it here as it is unecessary. Just a note for the future!

… changing the timeout use on page load to trigger transition. This can allow some components to be fully loaded and be able to query `sharedTransitionTag`
@cla-bot cla-bot bot added the cla: yes label Oct 16, 2023
@NathanWalker
Copy link
Contributor

NathanWalker commented Oct 24, 2023

I agree PageTransition constructor would be better as an options object. We could plan to move that direction for 9.0.

@NathanWalker NathanWalker merged commit e8c093d into NativeScript:main Oct 24, 2023
tdermendjiev pushed a commit to tdermendjiev/NativeScript that referenced this pull request Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants