Skip to content

Balloon not working in @AndroidEntryPoint Fragment (Dagger/Hilt) #953

@almeric

Description

@almeric

Please complete the following information:

  • Library Version 1.7.5

Describe the Bug:
When trying to show a balloon in compose in a Fragment annotated with @AndroidEntryPoint the balloon doesn't show up. Especially when used like so:

override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ) = content {
// Balloon here
}

This is likely due to the context which is dagger.hilt.android.internal.managers.ViewComponentManager$FragmentContextWrapper

When using the activity context it works:

override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ) = ComposeView(requireActivity()).apply {
        setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
        setContent {
           // Balloon here
        }
}

(Note the requireActivity())

Expected Behavior:

The balloon should show without explicitly using the activity context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions