Skip to content

Conversation

@aabewhite
Copy link
Contributor

Rebased version of #221

The ComposeContext now tracks an additional variable, scope, which users can use in ComposeView or ComposeModifierView to access scoped modifiers. https://developer.android.com/develop/ui/compose/modifiers#scope-safety

I've also added a new variant of .composeModifier(scope:) that allows users to declare a class to which their (Modifier) -> Modifier function will be scoped, making it easy to access modifiers scoped to that class.

Finally, I've set the scope variable in LazyHStack, LazyVStack, LazyHGrid, and LazyVGrid. There are probably a lot more places where this could be set.

The `ComposeContext` now tracks an additional variable, `scope`, which users can use in `ComposeView` or `ComposeModifierView` to access scoped modifiers. https://developer.android.com/develop/ui/compose/modifiers#scope-safety

I've also added a new variant of `.composeModifier(scope:)` that allows users to declare a class to which their `(Modifier) -> Modifier` function will be scoped, making it easy to access modifiers scoped to that class.

Finally, I've set the `scope` variable in `LazyHStack`, `LazyVStack`, `LazyHGrid`, and `LazyVGrid`. There are probably a lot more places where this could be set.
@cla-bot cla-bot bot added the cla-signed label Jan 25, 2026
@aabewhite aabewhite merged commit 35f8062 into main Jan 25, 2026
2 checks passed
@aabewhite aabewhite deleted the modifierscope2 branch January 25, 2026 19:17
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.

3 participants