I have a ComposeUIViewController which, under some...
# compose-ios
i
I have a ComposeUIViewController which, under some circumstances, may end up hosting another ComposeUIViewController inside of a UIKitViewController within the composition. I would have expected that Composition Locals set within the parent/root ComposeUIViewController to be available within the child ComposeUIViewController's composition, but it doesn't appear that this is the case. Is this expected behaviour/are there any plans to propagate Composition Locals in these situations?
a
We're not propagating locals to the inner ComposeUIViewController. I'd say, it is an expected behavior.
i
That's not how it works with Views/Fragments in Android though, is it? I might need to double check, but I thought that locals were passed down on Android. Would be nice to have consistency of behavior for these similar interop situations if it's possible
I have just confirmed that (at least for AndroidViews, I didn't check AndroidFragment, but I'm pretty sure it works the same way), CompositionLocals are passed down to nested ComposeViews. Given that, I'd like to suggest that the currently expected behaviour is reconsidered; when building a CMP/KMP application that is for both Android and iOS, it would be nice if the interop APIs worked in as much of a similar way as possible. This feels like it could be a "foot-gun" for people (like me) who are building things that rely on interop with platform view types.