Skip to content
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

Experimenting with safe versions of Shared element modifiers. #1417

Closed

Conversation

riggaroo
Copy link
Collaborator

Sometimes your composables may be created from places that don't have a AnimatedContentScope or SharedTransitionScope - for instance if you are opening up your app from a notifcation. Instead of throwing an IllegalArgumentException in these cases, it'd be best if the shared element modifiers, just didn't do anything if the scopes are not present.
This pull request creates new modifiers that wrap the shared element APIs, to skip their operation if the scopes are null. Modifiers such as: Modifier.safeSharedElement(), Modifier.safeSharedBounds(), Modifier.safeSkipToLookaheadSize(), Modifier.safeRenderInSharedTransitionScope().

Please note: This is in no way a complete solution at present, this is an experiment and subject to change. Please do leave feedback if you'd like to see changes to shared element APIs based on this use case.

Added Modifier.safeSharedElement, Modifier.safeSharedBounds, Modifier.safeSkipToLookaheadSize,
Modifier.safeRenderInSharedTransitionScope.
@riggaroo riggaroo closed this Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant